gpt4 book ai didi

php - 电子邮件中应该使用 PHP_EOL 吗?

转载 作者:可可西里 更新时间:2023-11-01 13:08:20 26 4
gpt4 key购买 nike

我看到很多使用“\r\n”的 PHP 电子邮件实现,但我也看到其中一些使用 PHP_EOL 常量。哪个更好?

感谢您的帮助
大都会

最佳答案

如果这是终止电子邮件中的行,那么您需要查看电子邮件的规范,而不是在任何特定平台上使用的规范。

根据 RFC2821,电子邮件中的行由 CRLF ("\r\n") 终止

SMTP commands and, unless altered by a service extension, message data, are transmitted in "lines". Lines consist of zero or more data characters terminated by the sequence ASCII character "CR" (hex value 0D) followed immediately by ASCII character "LF" (hex value 0A). This termination sequence is denoted as in this document. Conforming implementations MUST NOT recognize or generate any other character or character sequence as a line terminator

这似乎很清楚,在电子邮件中,行尾将作为\r\n 发送。发送任何其他内容可能有效,但除非您使用“服务扩展”,否则这是错误的,如果您使用了,那么您可能知道无论如何您应该发送什么。

关于php - 电子邮件中应该使用 PHP_EOL 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3248090/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com