PHP 中是否有可以规范化电子邮件地址的函数?
例如,如果大小写不重要,则 FOO@example.com
-> foo@example.com
。
我不知道电子邮件地址何时应被视为“相同”的规则,所以我不想自己实现。
最佳答案
维基百科汇总了各种 RFC 对 email address 的描述。应该成立。
不管其他人怎么说,电子邮件可以区分大小写
The local-part is case sensitive, so "jsmith@example.com" and "JSmith@example.com" may be delivered to different people. This practice is discouraged by RFC 5321. However, only the authoritative mail servers for a domain may make that decision. The only exception is for a local-part value of "postmaster" which is case insensitive, and should be forwarded to the server's administrator.
本地部分是指地址中@符号左边的部分。
因此,就您的具体问题(大小写规范化)而言,您可以将服务器部分(@ 的右侧)小写,但您认为最合适(由 @ 拆分,strToLower 服务器组件,重新组合)。
关于php - 如何在 PHP 中规范化电子邮件地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1168921/