php验证手机号码和邮箱
function isMobile($mobile
) {
if (!is_numeric($mobile
)) {
return false;
}
return preg_match('#^1[3,4,5,7,8,9]{1}[\d]{9}$#', $mobile
) ? true : false;
}
function isEmail($str
) {
if (!$str
) {
return false;
}
return preg_match('#[a-z0-9&\-_.]+@[\w\-_]+([\w\-.]+)?\.[\w\-]+#is', $str
) ? true : false;
}
转载请注明原文地址: https://yun.8miu.com/read-55816.html