我在这里尝试了很多解决方案。但没有什么对我有用。请指教。这是我的代码。
我的模特
规则
public $image_path;
public function tableName()
{
return 'check';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('status', 'required'),
array('status', 'numerical', 'integerOnly'=>true),
//array('image_path', 'unsafe'),
array('image_path', 'file', 'types'=>'jpg, gif, png','wrongType'=>'Only image files.','allowEmpty'=>true, 'on'=>'create','on'=>'update'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('c_id, image_path, status', 'safe', 'on'=>'search'),
);
}
答案 0 :(得分:0)
'on'=>'create','on'=>'update'
应该是
'on'=>'create, update'