33 lines
614 B
PHP
Executable File
33 lines
614 B
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: lock
|
|
* Date: 2019/3/24
|
|
* Time: 9:49 PM
|
|
*/
|
|
|
|
namespace app\index\validate;
|
|
|
|
|
|
use think\Validate;
|
|
|
|
class customValidate extends Validate
|
|
{
|
|
/**
|
|
* isMobile
|
|
* @param $value
|
|
* @param string $rule
|
|
* @param string $data
|
|
* @param string $field
|
|
* @return bool|string
|
|
*/
|
|
protected function isMobile($value,$rule = '',$data = '',$field = '')
|
|
{
|
|
if(preg_match('/^1(3|4|5|6|7|8|9)\d{9}$/', $value) === 1)
|
|
{
|
|
return true;
|
|
}else{
|
|
return $field.'手机号码格式不正确';
|
|
}
|
|
}
|
|
} |