我试图根据Yii 1.1.15中的当前页面网址检查我的复选框列表
在我看来:
$arr0 = array('1'=> 'store 1', '2'=> 'store 2', '3'=>'store 3' .......);
echo $form->checkBoxList($model,'store', $arr0,
array(
'name'=>'store',
'separator'=>'',
'template'=>'<span class="col-md-6 col-xs-6">{input} {label}</span>',
'uncheckValue'=>0
)
);
我的网址就像这样
url/?store=1,4,5,6
任何想法如何做到这一点?感谢
答案 0 :(得分:1)
在渲染checkBoxList
之前,只需将数组设置为模型,如下所示:
$arr0 = array('1','2');
$model->store=$arr0;
现在,1,2将被标记为已选中。