init
This commit is contained in:
49
app/validate/Admin.php
Normal file
49
app/validate/Admin.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Admin extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'username.require' => '用户名不得为空~',
|
||||
'username.min' => '用户名不得小于 2 位~',
|
||||
'username.max' => '用户名不得大于 10 位~',
|
||||
'username.chsDash' => '用户名只能是汉字、字母、数字或下划线以及破折号~',
|
||||
'nickname.require' => '昵称不得为空~',
|
||||
'nickname.min' => '昵称不得小于 2 位~',
|
||||
'nickname.max' => '昵称不得大于 10 位~',
|
||||
'nickname.chsDash' => '昵称只能是汉字、字母、数字或下划线以及破折号~',
|
||||
'username.unique' => '用户名已存在~',
|
||||
'password.require' => '密码不得为空~',
|
||||
'password.min' => '密码不得小于 6 位~',
|
||||
'passwordnot.require' => '密码确认不得为空~',
|
||||
'passwordnot.confirm' => '密码确认和密码不一致~',
|
||||
'email.require' => '电子邮件不得为空~',
|
||||
'email.email' => '电子邮件格式不正确~',
|
||||
'email.unique' => '电子邮件已存在~',
|
||||
'phone.require' => '电话不得为空~',
|
||||
'phone.number' => '必须全部为数字~',
|
||||
'phone.length' => '手机号长度必须为11位',
|
||||
'phone.unique' => '手机号已存在~'
|
||||
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user