简单的手机邮箱验证

/**
* 验证输入的邮箱格式是否合法
* @access public
* @param string m o b i l e p h o n e @ r e t u r n b o o l / f u n c t i o n i s e m a i l ( mobile_phone * 需要验证的邮箱格式 * @return bool */ function is_email( email)
{
$chars = “/^([a-z0-9+]|\-|\.)+@(([a-z0-9]|\-)+\.)+[a-z]{2,6}$/i”;
if (strpos(KaTeX parse error: Expected 'EOF', got '&' at position 23: …'@') !== false &̲& strpos(email, ‘.’) !== false)
{
if (preg_match($chars, $email))
{
return true;
}else{
return false;
}
}else{
return false;
}
}
/**
* 验证输入的手机号码是否合法
* @access public
* @param string m o b i l e p h o n e @ r e t u r n b o o l / f u n c t i o n i s m o b i l e p h o n e ( mobile_phone * 需要验证的手机号码 * @return bool */ function is_mobile_phone ( mobile_phone)
{
c h a r s = " / 1 3 [ 0 9 ] 1 [ 0 9 ] 8 chars = "/^13[0-9]{1}[0-9]{8} |15[0-9]{1}[0-9]{8} 18 [ 0 9 ] 1 [ 0 9 ] 8 |18[0-9]{1}[0-9]{8} |17[0-9]{1}[0-9]{8} / " ; i f ( p r e g m a t c h ( /"; if(preg_match( chars, $mobile_phone))
{
return true;
}
return false;
}

猜你喜欢

转载自blog.csdn.net/weixin_43023551/article/details/88101515