// +---------------------------------------------------------------------- namespace app\adminapi\validate\user; use think\Validate; class UserValidata extends Validate { /** * 定义验证规则 * 格式:'字段名' => ['规则1','规则2'...] * * @var array */ protected $rule = [ 'account' => 'require|alphaNum', 'pwd' => 'require', 'true_pwd' => 'require', 'nickname' => 'require', ]; /** * 定义错误信息 * 格式:'字段名.规则名' => '错误信息' * * @var array */ protected $message = [ 'account.require' => '400254', 'account.alphaNum' => '400089', 'pwd.require' => '400134', 'true_pwd.require' => '400263', 'nickname.number' => '400187' ]; }