1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- declare (strict_types = 1);
- namespace app\validate;
- use think\Validate;
- class User extends Validate
- {
- /**
- * 定义验证规则
- * 格式:'字段名' => ['规则1','规则2'...]
- *
- * @var array
- */
- protected $rule = [
- 'name' => 'require|max:25|chs',
- 'type' => 'require|max:25',
- 'contacts' => 'require|max:25|chs',
- 'post' => 'require|max:25',
- 'phone' => 'require|mobile',
- 'password' => 'require|alphaNum|min:6',
- ];
- /**
- * 定义错误信息
- * 格式:'字段名.规则名' => '错误信息'
- *
- * @var array
- */
- protected $message = [
- 'name.require' => '企业名称必填',
- 'type.require' => '企业类型必填',
- 'post.require' => '职务名称必填',
- 'password.require' => '密码必填',
- 'name.chs' => '姓名必须为汉字',
- 'contacts.chs' => '联系人姓名必须为汉字',
- 'contacts.max' => '联系人姓名不能超过25个字符',
- 'contacts.require' => '联系人姓名必填',
- 'name.max' => '姓名最多不能超过25个字符',
- 'phone.mobile' => '联系电话不合法',
- 'password.alphaNum'=> '密码必须数字和字母',
- 'password.min'=> '密码最低为6位',
- ];
- }
|