Home > Backend Development > PHP Tutorial > PHP code to determine whether it is a valid email address_PHP tutorial

PHP code to determine whether it is a valid email address_PHP tutorial

WBOY
Release: 2016-07-13 16:55:51
Original
735 people have browsed it

This article introduces a custom function, which is about determining whether it is a valid email address. In fact, it is what we often call regular verification of email addresses. If you are interested, take a look.

The code is as follows
 代码如下 复制代码

// 函数名: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;

}

Copy code
// Function name: CheckEmailAddr($C_mailaddr)

// Function: Determine whether it is a valid email address

//Return value: Boolean value // Remarks: None 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; } http://www.bkjia.com/PHPjc/631663.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631663.htmlTechArticleThis article introduces a custom function, which is about determining whether it is a valid email address. In fact, it is what we often call regularity Your email address has been verified. If you want to see it, please take a look. Code...
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