// +---------------------------------------------------------------------- namespace app\validate\admin\user; use think\Validate; class UserValidate extends Validate { /** * 定义验证规则 * 格式:'字段名' => ['规则1','规则2'...] * * @var array */ protected $rule = [ 'pwd' => 'require|length:4,64', ]; /** * 定义错误信息 * 格式:'字段名.规则名' => '错误信息' * * @var array */ protected $message = [ 'pwd.require' => '请填写密码', 'pwd.length' => '密码4-64长度字符', ]; }