'require|length:3,20|chsDash', 'password' => 'require|length:6,20', 'email' => 'require|email', 'phone' => 'mobile', 'nickname' => 'length:2,20', ]; /** * 验证提示信息 */ protected $message = [ 'username.require' => '用户名不能为空', 'username.length' => '用户名长度3-20位', 'username.chsDash' => '用户名只能是汉字、字母、数字和下划线_及破折号-', 'password.require' => '密码不能为空', 'password.length' => '密码长度6-20位', 'email.require' => '邮箱不能为空', 'email.email' => '邮箱格式不正确', 'phone.mobile' => '手机号格式不正确', 'nickname.length' => '昵称长度2-20位', ]; /** * 验证场景 */ protected $scene = [ 'login' => ['username', 'password'], 'register' => ['username', 'password', 'email'], 'update' => ['email', 'phone', 'nickname'], ]; }