Php script that test e
Possible Duplicate:
Is there a php library for email address validation?
How I can write php script that test e-mail address is input correctly and verify that the input begins with a series of character followed by the @
character, another series of character and a final series of characters.
使用FILTER_VALIDATE_EMAIL
过滤器的filter_var()
函数应该完全符合你的要求 - 无需重新发明轮子;-)
使用带有FILTER_VALIDATE_EMAIL
标志的PHP函数filter_var()
来验证电子邮件地址:
$emailValid = filter_var($email, FILTER_VALIDATE_EMAIL);
if($emailValid) {
echo "Email is valid";
} else {
echo "Email is INVALID";
}
I mostly use filter_var
for this, but a fellow github'r notified me that this function is flawed.
He recommended to use the rather more complex validator at http://www.dominicsayers.com/isemail/.
Good luck!
链接地址: http://www.djcxy.com/p/92720.html上一篇: PHP中的电子邮件验证
下一篇: Php脚本测试e