php正则验证手机、邮箱

//验证电话
private function reg_phone($phone){
        if (preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$phone){
            return true;
        else{
            return false;
        }
    }
//验证邮箱
private function check_email($mail){
    if(preg_match('/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/'$mail))
        return true
    }else
        return false
    
}

posted @ 2017-08-09 23:40  shaoguan  阅读(636)  评论(0编辑  收藏  举报