Home > php教程 > php手册 > php 判断是否为有效邮件地址实现代码

php 判断是否为有效邮件地址实现代码

WBOY
Release: 2016-06-13 10:00:50
Original
1056 people have browsed it

本文章介绍一个自定义函数,就是关于判断是否为有效邮件地址 ,其实就是我们常说的正则验证邮箱地址了,好了有面要的同学看看。

 代码如下 复制代码

// 函数名:CheckEmailAddr($C_mailaddr)

// 作 用:判断是否为有效邮件地址

// 参 数:$C_mailaddr(待检测的邮件地址)

// 返回值:布尔值

// 备 注:无

function CheckEmailAddr($C_mailaddr)

{

if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*$",

$C_mailaddr))

//(!ereg("^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$",

$c_mailaddr))

{

return false;

}

return true;

}

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template