UserVali.php 717 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. class UserVali extends Validate
  5. {
  6. protected $regex = ['zip'=>'^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,16}$'];
  7. protected $rule = [
  8. 'phone' => 'require',
  9. 'email' => 'require|email',
  10. 'password' => 'require|regex:zip',
  11. ];
  12. protected $message = [
  13. 'phone.require' => '手机号必填',
  14. 'email.email' => '必须是邮箱',
  15. 'password.require' => '密码必填',
  16. 'password.regex' => '6-16位数字字母组合',
  17. ];
  18. protected $scene=[
  19. 'reset_password'=>['phone','password'],
  20. 'phone_login'=>['phone'],
  21. 'email_login'=>['email'],
  22. ];
  23. }