我正在尝试在 URL 参数中传递变量 $time。整个小部件位于 foreach 循环内,$time
每次执行 lop 时都会更新。现在我面临的问题是 $time (在 url 参数中传递)没有更新。
$dataProvider = StaffHours::model()->findAll();
$start = strtotime('12:00am');
$end = strtotime('12:45am');
for( $i = $start; $i <= $end; $i += 900)
{
$time = date('g:i A', $i);
foreach($dataProvider as $data)
{
$monday = unserialize($data->monday);
$this->widget('bootstrap.widgets.TbEditableField', array(
'type' => 'select',
'model' => $data,
'attribute' => 'monday',
'url' => $this->createUrl('staffhours/editstaffhour&Time='.$time ), //url for submit data
'source' => array('Online', 'Offline', 'AwayDate'),
'enabled' => true,
'options' => array('params' => array('time'=>$time),)
));
}
}