php判断手机号码

 
    //PHP判断手机号码
     public function isMobile($params)
    {
        $pattern = "/^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9])\d{8}$/";
        return preg_match($pattern,$params);
    }
  
//PHP判断手机号码
    public static function isMobile($mobile = null)
    {
        if (is_null($mobile)) $mobile = $this->number;
        if (preg_match('/1[34578]{1}\d{9}/', $mobile)) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
//JS里面判断手机号码
function isMobilePhone (mobilePhone){
    var patrn = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))\d{8})$/;
    if (patrn.exec(mobilePhone) == null || mobilePhone == "") {
        return false
    } else {
        return true
    }
}

 

posted @ 2015-02-13 17:43  三变  阅读(1035)  评论(0编辑  收藏  举报