最完整的php验证手机号码

最完整的php验证手机号码:

移动:134、135、136、137、138、139、150、151、152、157、158、159、182、183、184、187、188、178(4G)、147(上网卡);

联通:130、131、132、155、156、185、186、176(4G)、145(上网卡);
电信:133、153、180、181、189 、177(4G);
卫星通信:1349

虚拟运营商:170

function checkPhoneNumber($phone_number){
        //@2017-11-25 14:25:45 https://zhidao.baidu.com/question/1822455991691849548.html
        //中国联通号码:130、131、132、145(无线上网卡)、155、156、185(iPhone5上市后开放)、186、176(4G号段)、175(2015年9月10日正式启用,暂只对北京、上海和广东投放办理),166,146
        //中国移动号码:134、135、136、137、138、139、147(无线上网卡)、148、150、151、152、157、158、159、178、182、183、184、187、188、198
        //中国电信号码:133、153、180、181、189、177、173、149、199
        $g = "/^1[34578]\d{9}$/";
        $g2 = "/^19[89]\d{8}$/";
        $g3 = "/^166\d{8}$/";
        if(preg_match($g, $phone_number)){
            return true;
        }else  if(preg_match($g2, $phone_number)){
            return true;
        }else if(preg_match($g3, $phone_number)){
            return true;
        }
 
        return false;
 

 

posted @   树下水月  阅读(186)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示