我只是设置一个表单的验证,我决定尝试使用filter_var函数来检查我的电子邮件地址的有效性.我无法找到什么filter_var实际允许的地方(因为文档很简单),我发现它允许一个电子邮件地址,如test @ test.在域中不必有.com,.net等…
这个行为在四月份左右发生了变化.见
bug #49576和
revision 297350.
原文链接:https://www.f2er.com/php/131695.html那个电子邮件确实是无效的,至少这是PHP开发人员所理解的.来源提供此通知:
/* * The regex below is based on a regex by Michael Rushton. * However,it is not identical. I changed it to only consider routeable * addresses as valid. Michael's regex considers a@b a valid address * which conflicts with section 2.3.5 of RFC 5321 which states that: * * Only resolvable,fully-qualified domain names (FQDNs) are permitted * when domain names are used in SMTP. In other words,names that can * be resolved to MX RRs or address (i.e.,A or AAAA) RRs (as discussed * in Section 5) are permitted,as are CNAME RRs whose targets can be * resolved,in turn,to MX or address RRs. Local nicknames or * unqualified names MUST NOT be used.