首页 > 编程知识 正文

thinkphp能直接用吗(validate)

时间:2023-05-03 19:59:58 阅读:68012 作者:74

1 .目录结构2 .控制器参考保护性$验证; public function _ _ construct ({ $ this-validate=newindex validate ); //与此控制器对应的验证规则parent:__construct (; }/* *前端提交的post值**/public function Index () { $posts=$this-request-post ); $ this-validate-scene (索引)-check )|$this-error ) $this-validate-geterror )、[], 202 } 3.validate文件classindexvalidateextendsvalidate {//规则定义protected $ rule=[ ' page '=' require|egt :1 ',//] } 4.validate规则保护性静态$ type msg=[ ' require '=' 3360 attribute require ',' must'=':attribute must ',' ' integer '=' : attributemustbeinteger ',' float'='3360attributemust ',' float '=' 3360 attribute must ' bolean ' email '=' : attributenotavalidemailaddress ',' mobile '=' 3360 attributenotavalidemailaddress ', ' mobile '=' 360 attribuute ' array '=' : attributemustbeaarray ',' accepted '=' : attributemustbeyes, on or感动的天空' date '=' : attribute not ' file '=' : attributenotavalidfile ',' image '=' : attributenotavalididimage ' alpha '=' : attribute must be ' alpha num '=' : attributemustbealpha-numeric ',' alpha dash '=' 3: atribute mute mute undersh ' active URL '=' : attributenotavaliddomainorip ',' CHS '=' : attributemustbechinese ',' CHS alpha '=' 3360 ' chsalphanum '=' : attributemustbechinese,alpha-numeric ',' CHS dash '=' : attributemustbechinese,alpha-numeric ' URL '=' : attributenotavalidurl ' ' IP '=' : attribute not a valid IP ',' date format '=' 3: attributemutemustbedatedatefate ' in '=' : attributemustbein : rule ',' not in '=' : attributebenotin : rule ',' between '=' : atributen ' not between '=' : attributenotbetween 33601-:2 ',' length '=' sizeof : attribute must be : rule ',' max=' min '=' min sizeof : attribute must be : rule ',' after '=' : attributecannotbelessthan 3360 rule ',' before=' ' after with '=' : attributecannotbelessthan : rule ',' before with '=' : attributecanotexceeeed : rule ',' exppppt ' allow IP '=' allow IP ' ' deny IP '=' access IP denied ',' confirm '=' : attributeoutofaccordwith 33602 ', ' different '=' : attributecannied ' egt '=' : attributemustgreaterthanorequal : rule ',' gt '=' 3: atribuate ' ELT '=' : attributemustlessthanorequal : rule ',' lt '=' : attributemustlessthan : rule ',' eq=' 33: ' unique '=' : attributehasexists ',' regex '=' : attributenotconfists ',' 3360 attributenotconfists ' ' method ' ' token'='invalid token ',' fileSize'='filesize not match ',' fileext'='eeext '

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。