Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 电子邮件--在电子邮件中使用新行的正确方法是什么?_Php_Email - Fatal编程技术网

Php 电子邮件--在电子邮件中使用新行的正确方法是什么?

Php 电子邮件--在电子邮件中使用新行的正确方法是什么?,php,email,Php,Email,我尝试使用html,但它在电子邮件中显示文本,所以我将其更改为纯文本。还是不能断线 我不知道为什么它没有像我想的那样工作 编辑#2 $message = 'New user registration\n\n There is a new submission on the site and below are the details.\n\n'; $umessage.=''; 问题是它会显示在电子邮件中: 有什么办法吗 尝试使用“\r\n”作为换行符 $umessage .= '<

我尝试使用html,但它在电子邮件中显示文本,所以我将其更改为纯文本。还是不能断线

我不知道为什么它没有像我想的那样工作

编辑#2

$message = 'New user registration\n\n
There is a new submission on the site and below are the details.\n\n';
$umessage.='';
问题是它会显示在电子邮件中:

有什么办法吗

尝试使用“\r\n”作为换行符

$umessage .=    '<a href="'.$pdflink.'">Download Brochure</a>';

使用单引号字符串时,不会解释换行符。您需要使用
来封装字符串

此外,为了与邮件客户端兼容,您应该使用
\r\n

$message = 'New user registration\r\n
There is a new submission on the site and below are the details.\r\n';

这是正确的。请注意burhan的回答,他提出了一个很好的观点,即对包含换行符的字符串使用双引号。a href链接有什么办法吗?请创建一个新问题。每篇文章你应该问一个问题。“当你使用单引号字符串时,不会解释换行符。”。“这才是重要的。谢谢你的回答。
$message = "New user registration\r\n
There is a new submission on the site and below are the details.\r\n";