IntermediaryValidate.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace api\portal\validate;
use think\Validate;
class IntermediaryValidate extends Validate
{
protected $rule = [
'name' => ['require','length:2,4','chs'],
'password' => ['require','length:6,16'],
'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/','require'],
];
protected $message = [
'name.require' => '姓名不能为空!',
'name.length' => '姓名为2-4个汉字!',
'name.chs' => '姓名只能是汉字!',
'tel.require' => '手机号不能为空!',
'tel.regex' => '手机号格式不正确!',
'password.require' => '密码不能为空!',
'password.length' => '密码长度为6-16位!',
];
protected $scene = [
'add' => ['name','tel','password'],
'edit' => ['tel','password','name'],
];
}