验证PHP中的电子邮件地址 [英] Validate email address in PHP

查看:125
本文介绍了验证PHP中的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何验证PHP中的邮件地址


我想知道每个人在验证电子邮件地址方面的做法以及验证需要多大。



例如,在这些方法中,哪一个是首选的,为什么?


  1. 广泛检查: http://www.linuxjournal.com/article/9585?page=0,3

  2. PHP过滤器: http://php.net/manual/en/filter.filters.validate.php

  3. Eregi: http:// www。 totallyphp.co.uk/co de / validate_an_email_address_using_regular_expressions.htm

  4. 与DNS检查匹配: http://www.soaptray.com/blog/2008/04/validate-email-addresses-using-php/

我的目标是为平均项目找到一个很好而坚实的解决方案,所以当时间来验证一个电子邮件地址时,我知道我是什么, m / p>

任何反馈都非常感谢!



-Ryan

解决方案

http:// www。 regular-expressions.info/email.html 具有RFC2822建议的注释。


Possible Duplicate:
How to validate an emailaddress in PHP

I was wondering what everyone is doing in regards to validating email addresses and how extensive the validation needs to be.

For example, of those methods, which one is preferred and why?

  1. Extensive check: http://www.linuxjournal.com/article/9585?page=0,3
  2. PHP filter: http://php.net/manual/en/filter.filters.validate.php
  3. Eregi: http://www.totallyphp.co.uk/code/validate_an_email_address_using_regular_expressions.htm
  4. Preg match with DNS check: http://www.soaptray.com/blog/2008/04/validate-email-addresses-using-php/

My goal is to find a good and solid solution for the average project, so when the time comes to validate an email address, I know exactly what I'm going to use.

Any feedback much appreciated!

-Ryan

解决方案

http://www.regular-expressions.info/email.html has the RFC2822 recommended reg ex.

这篇关于验证PHP中的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆