管理员添加与修改、添加验证但没测试
This commit is contained in:
1 parent
f0bd8ead5d
commit
0013f62d65
11 files changed
+301
-57
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Admin extends Validate
|
||||
{
|
||||
/**
|
||||
* 定义验证规则
|
||||
* 格式:'字段名' => ['规则1','规则2'...]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'xingming' => 'require|chs|length:2,6',
|
||||
'username' => ['require','ustr'=>'/^[\u4e00-\u9fa5]*$/']
|
||||
'shengri' => 'date',
|
||||
'xingbie' => 'in:0,1,2',
|
||||
'phone' => 'mobile',
|
||||
'beizhu' => 'max:80',
|
||||
];
|
||||
|
||||
/**
|
||||
* 定义错误信息
|
||||
* 格式:'字段名.规则名' => '错误信息'
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'username.ustr' => '帐号格式错误',
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user