💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` application\copyy\validate\User.php ~~~ namespace app\copyy\validate; use think\Validate; class User extends Validate { protected $rule = [ 'name' => 'require|max:25', 'email' => 'email', 'age' => 'number|between:[1,100]' ]; protected $message = [ 'name.require' => '名称必须', 'name.max' => '名称最多不能超过25个字符', 'age.number' => '年龄为数字', 'age.between' => '年龄只能为1-100之间', 'email' => '邮箱格式错误' ]; } ~~~ ``` ``` application\copyy\controller\Index.php ~~~ public function login() { $data = [ 'name' => 'zzz', 'email' => 'thinkphp@qq.com', 'age' => '111' ]; $validate = new User(); if(!$validate->check($data)){ dump($validate->getError()); }else{ } } ~~~ ```