首页 > 代码库 > php验证手机号是否正确

php验证手机号是否正确

if(!preg_match("/^13[0-9]{1}[0-9]{8}$|15[0-9]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|145[0-9]{8}$$/",$phone)){
echo "<script>alert(‘手机号不正确!‘)</script>";
echo "<script>location=‘register.php‘</script>";
exit;
}

php验证手机号是否正确