ValidateService.php 423 B

123456789101112131415161718192021222324
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User : zgcLives
  5. * CreateTime : 2022/6/1 11:56
  6. */
  7. namespace addons\exam\library;
  8. class ValidateService
  9. {
  10. /**
  11. * 验证手机号
  12. * @param $phone
  13. * @return false|int
  14. */
  15. public static function phone($phone)
  16. {
  17. if (!$phone || !\think\Validate::regex($phone, "^1\d{10}$")) {
  18. return false;
  19. }
  20. return true;
  21. }
  22. }