[已解决]图像字段限制了类型就变成必填字段了吗? [ 新手入门 ]
public function rules() {
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('front_img', 'file', 'types'=>'jpg, gif, png'),
不选文件就通不过验证,限制上传的类型同时也限制了必填,怎么设置选填,只有选了文件的时候才检查类型呢?
共 2 条回复
webyjh
注册时间:2011-12-12
最后登录:2016-10-06
在线时长:1小时45分
最后登录:2016-10-06
在线时长:1小时45分
- 粉丝2
- 金钱1090
- 威望0
- 积分1100