Php email address, URL, and mobile phone number validity regular. 1. Email judgment: the code is as follows? Phpfunctionis_email ($ email) {returnstrlen ($ email) 6preg_match (^ [w-.] + @ [w-] + (. w +) + $, $ email );}? 2. Url determination: the code is as follows: functionis_url ($ str 1. Email judgment:
The code is as follows:
Function is_email ($ email ){
Return strlen ($ email)> 6 & preg_match ("/^ [w-.] + @ [w-] + (. w +) + $/", $ email );
}
?>
2. determine the 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 );
}
Http://www.bkjia.com/PHPjc/371790.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371790.htmlTechArticle1. judge Email: the code is as follows? Php function is_email ($ email) {return strlen ($ email) 6 preg_match (/^ [w-.] + @ [w-] + (. w +) + $/, $ email );}? 2. determine the Url: the code is as follows: function is_url ($ str...