问题:strcmp()
期望参数 2 是字符串,给定数组。
用户更新时会出现此错误消息。用户创建工作正常。我怎么解决这个问题?
我创建radiobuttonlist
如下:
<div style="height:140px; padding-left: 20px;">
<div>
<?php echo $form->labelEx($model,'role'); ?>
<?php
echo $form->radioButtonList(
$model,
'role',
$roles,
array(
'labelOptions'=>array('style'=>'display:inline; padding-right: 1em; vertical-align:middle '), // add this code
)
);
?>
<?php echo $form->error($model,'role'); ?>
</div>
</div>
$roles
来自控制器:
if(Yii::app()->user->isSuperuser) {
$all_roles=new RAuthItemDataProvider('roles', array('type'=>2, ));
$roles = $all_roles->fetchData();
} else {
$roles = Authitem::model()->findAll('type=2 And name<>:name',array(':name'=>'Superadmin'));
$original_roles = Authassignment::model()->findAll('userid=:userid',array(':userid'=>$model->id));
$model->role = CHtml::listData($original_roles, 'itemname', 'itemname');
$roles = CHtml::listData($roles,'name','name');
//$model->role = array_merge($original_roles, $roles);
//$model->role = (array)$original_roles;
//var_dump($model->role);
//die;
$this->render('update',array(
'model'=>$model,
'profile'=>$profile,
'roles'=>$roles,
//'department'=>$department,
//'designation'=>$designation,
'original_roles'=>$original_roles,
));
}
当我使用 as$form->checkBoxList
时,它工作正常。