public function rules(){return array(array('PRoject_id, type_id, status_id, owner_id, requester_id,', 'numerical', 'integerOnly'=>true),array('name', 'length', 'max'=>256),array('descr //required: 必填array('title,content','required'), //match: 正則表達式驗證array('birthday', 'match', 'pattern'=>'%^/d{4}(/-|//|/.)/d{1,2}/1/d{1,2}$%', 'allowEmpty'=>true, 'message'=>'生日必須是年-月-日格式'), //email:郵箱格式驗證array('user_mail', 'email'), //url:URL格式驗證array('user', 'url'), //unique:唯一性驗證array('username', 'unique','caseSensitive'=>false,'className'=>'user','message'=>'用戶名"{value}"已經被注冊,請更換'),//caseSensitive 定義大小寫是否敏感 //compare:一致性驗證array('repassWord', 'compare', 'compareAttribute'=>'password','message'=>'兩處輸入的密碼并不一致'), //length:長度驗證 //in: 驗證此屬性值在列表之中(通過range指定)。 //numerical: 驗證此屬性的值是一個數字 //captcha: 驗證屬性值和驗證碼中顯示的一致array('verifyCode','captcha'), //type: 驗證屬性的類型是否為type所指定的類型. //file: 驗證一個屬性是否接收到一個有效的上傳文件 //default: 屬性指定默認值 //exist: 驗證屬性值在數據庫中是否存在 //boolean: 驗證布爾屬性值 //date: 檢驗此屬性是否描述了一個日期、時間或日期時間 //safe: 屬性標志為在批量賦值時是安全的。 //unsafe: 標志為不安全,所以他們不能被批量賦值。
新聞熱點
疑難解答