php 使用正则验证手机号
验证手机号:
/**
* 验证手机号格式
* @param string $mobile 手机号
* @return bool
*/
function validate_mobile($mobile = '')
{
if (empty($mobile) || !is_numeric($mobile)) {
return false;
}
if (!preg_match("/^1[3456789]{1}\d{9}$/", $mobile)) {
return false;
}
return true;
}本文为原创文章,转载无需和我联系,但请注明来自:http://www.baiyongj.com/news/476.html
上一篇:php 获取header头部信息