gpt4 book ai didi

php - php邮件中\r\n和\n\n的区别

转载 作者:可可西里 更新时间:2023-10-31 23:55:01 25 4
gpt4 key购买 nike

我正在设置一个 php 邮件发送脚本...

在添加不同的标题时,我在电子邮件中遇到了换行的符号(因为 < br > 标签不会)...

所以我的问题是\r\n 和\n\n 之间有什么区别?

例如:

echo $var1 . " \r\n" . $var2 . "\n\n";

感谢您的帮助!

最佳答案

\r\n 是标准。

来自 RFC 2822

Messages are divided into lines of characters. A line is a series of characters that is delimited with the two characters carriage-return and line-feed; that is, the carriage return (CR) character (ASCII value 13) followed immediately by the line feed (LF) character (ASCII value 10). (The carriage-return/line-feed pair is usually written in this document as "CRLF".)

另一个 \n\n 只有 2 行。

如果这是电子邮件标题,我相信它会是

echo $var1 . " \r\n" . $var2 . "\r\n\r\n";

这里的\r\n\r\n是header和body的分隔符。可以是 HTTP 或 SMTP

关于php - php邮件中\r\n和\n\n的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10223292/

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