thinkPHP?????????????
???????????? ???????[ 2015/3/19 14:38:55 ] ??????????????? ??????? ???? ????
????thinkphp ??Model?????????????????????????????????????????????????????????????????????$_validate??????????
????1?????????Model??????????? protected $_validate = array(); // ??????????????????????????????????????????????????
????2??
public function CheckVerify($verify) {
if (md5($verify) != Session::get('verify')) return false;
return true;
}
//??????
protected $_validate = array(
array("title"?? "require"?? "???????")??
array('categoryId'?? 'require'?? "??????")??
array('content'?? 'require'?? "???????")??
array('verify'?? 'require'??'????????')??
array('verify'?? 'CheckVerify'?? '????????'?? 0?? 'callback')
);
????3??????????array(?????Σ???????????????????????????????????????)??
????4???????????
?????????Σ????????????????????????β?????????????Σ?????????????Щ??????Σ?????????????????????
??????????? ?????????????????????????????????????????????????£???????????????
1 $validate = array(
2
3 'require'=> '/.+/'??
4
5 'email' => '/^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/'??
6
7 'url' => '/^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&_~`@[]':+!]*([^<>""])*$/'??
8
9 'currency' => '/^d+(.d+)?$/'??
10
11 'number' => '/^d+$/'??
12
13 'zip' => '/^[1-9]d{5}$/'??
14
15 'integer' => '/^[-+]?d+$/'??
16
17 'double' => '/^[-+]?d+(.d+)?$/'??
18
19 'english' => '/^[A-Za-z]+$/'??
20
21 );
???????????? ?????????????????????壨??????
????????????????????
????????????????????????
????Model::EXISTS_TO_VAILIDATE ????0 ?????????? ??????
????Model::MUST_TO_VALIDATE ????1 ???????
????Model::VALUE_TO_VAILIDATE????2 ?????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11