[moka学习笔记]yii2.0 rules的用法(收集,不定期更新)
public function rules(){ return [ ['title','required','message'=>'标题不能为空'], ['title','string','min'=>2,'max'=>200,'tooShort'=>'标题不能少于两位','tooLong'=>'标题不能大于200位'], ['content','required','message'=>'内容不能为空'], ['description','string','max'=>500,'tooLong'=>'描述不能大于500位'], ['flag','integer','min'=>0,'max'=>9,'tooSmall'=>'非法操作','tooBig'=>'超过了长度'], ['count','integer','min'=>0,'tooSmall'=>'必须是大于等于0的整数','message'=>'请输入整数'], ['status','in','range'=>['0','1'],'message'=>'非法操作'] ]; }
我生活的地方,我为何要生活。