Home > php教程 > PHP源码 > PHP验证邮件地址实例

PHP验证邮件地址实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-08 17:27:43
Original
1213 people have browsed it

在我们生活中,或是说网络编程中经常会碰到PHP验证邮件地址的要求,下面我们就来看看关系PHP验证邮件地址代码与实例吧。

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

 

电子邮件验证也许是中最常用的网页表单验证,此代码除了验证电子邮件地址,也可以选择检查邮件域所属 DNS 中的 MX 记录,使邮件验证功能更加强大。

function is_valid_email($email, $test_mx = false)
{
if(eregi("^([_a-z0-9-]+)(.[_a-z0-9-]+)*@([a-z0-9-]+)(.[a-z0-9-]+)*(.[a-z]{2,4})$", $email))
if($test_mx)
{
list($username, $domain) = split("@", $email);
return getmxrr($domain, $mxrecords);
}
else
return true;
else
return false;
}

Related labels:
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
Latest Issues
PHP mail function cannot send email completely
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot complete sending email
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot complete sending email
From 1970-01-01 08:00:00
0
0
0
PHP mail function cannot send email completely
From 1970-01-01 08:00:00
0
0
0
PHP mail function did not complete sending email
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template