Home  >  Article  >  Backend Development  >  PHP email, website, mobile phone number legality rules_PHP tutorial

PHP email, website, mobile phone number legality rules_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 14:51:451170browse

1. Judgment Email:

The code is as follows
function is_email($email){
return strlen($email) > 6 && preg_match("/^[w-.]+@[w-]+(.w+)+$/", $email);
}
?>

2. Determine Url:

The code is as follows

function is_url($str){
return preg_match("/^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&_~`@[]':+!]*( [^<>"])*$/", $str);
}

3. Determine the mobile phone number:

The code is as follows
function is_mobile($str){
Return preg_match("/^(((d{3}))|(d{3}-))?13d{9}$/", $str);
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/371790.htmlTechArticle1. Determine Email: The code is as follows?php function is_email($email){ return strlen($email) 6 preg_match (/^[w-.]+@[w-]+(.w+)+$/, $email); } ? 2. Determine Url: The code is as follows function is_url($str...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn