36 lines
728 B
PHP
36 lines
728 B
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-12-2
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\components;
|
|
|
|
|
|
class Validation
|
|
{
|
|
public static function mobile_regx($mobile_prefix = '86')
|
|
{
|
|
//@TODO
|
|
$list = [
|
|
'86' => '/1[23456789]\d{9}$/'
|
|
];
|
|
return isset($list[$mobile_prefix]) ? $list[$mobile_prefix] : null;
|
|
}
|
|
|
|
public static function is_mobile($mobile, $mobile_prefix = "86")
|
|
{
|
|
$pattern = self::mobile_regx($mobile_prefix);
|
|
if($pattern == null)
|
|
return true;
|
|
if(preg_match($pattern, $mobile)){
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} |