Home >php教程 >PHP源码 >一个简单PHP验证邮箱合法性的函数

一个简单PHP验证邮箱合法性的函数

WBOY
WBOYOriginal
2016-06-08 17:24:381438browse

一个简单的php邮箱难函数,有需要的学习的朋友可参考本文章。

<script>ec(2);</script>

一个简单PHP验证邮箱合法性的函数,功能很全,记下备用。

 代码如下 复制代码
$mail = 'wan.ch_un0222@126.qq.com';
 
function vaildEmail($mail){
 
 //验证邮箱
 
 if (empty($mail) || !preg_match("/^[-a-zA-Z0-9_.]+@([0-9A-Za-z][0-9A-Za-z-]+.)+[A-Za-z]{2,5}$/",$mail)){
 
     return false;     
 
 }else{
 
     return true;
 
 }
 
}
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