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

  1. /**
  2. * @param INT $mobile
  3. */
  4.  function isMobile($mobile) {
  5.     if (!is_numeric($mobile)) {
  6.         return false;
  7.     }
  8.     return preg_match('#^13[d]{9}$|^14[5,7]{1}d{8}$|^15[^4]{1}d{8}$|^17[0,6,7,8]{1}d{8}$|^18[d]{9}$#', $mobile) ? true : false;
  9.  }

感觉还不错。

原文地址:https://www.cnblogs.com/liuwenbohhh/p/4465373.html