PHP email, website, mobile phone number legality rules_PHP tutorial

WBOY
Release: 2016-07-21 14:51:45
Original
1182 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!