手机号码验证判断php函数实例讲解
手机号码验证判断php函数
- <?php
- function checkMobile($str)
- {
- $pattern = "/^(13|15)d{9}$/";
- if (preg_match($pattern,$str))
- {
- Return true;
- }
- else
- {
- Return false;
- }
- }
- //调用函数
- $str = checkMobile("15800000001");
- if($str)
- {
- echo("符合手机号码标准");
- }
- else
- {
- echo("不符合手机号码标准");
- }
- ?>
/phprm/25132.htmlwww.phpzy.comtrue/phprm/25132.htmlTechArticle手机号码验证判断php函数实例讲解 手机号码验证判断php函数 ?php function checkMobile($str) { $pattern = "/^(13|15)d{9}$/"; if (preg_match($pattern,$str)) { Return true; } else { Return false; } } //调用函数 $str = c...
PHP之友评论