换行不能在PHP邮件中工作 [英] newline not working in PHP mail
本文介绍了换行不能在PHP邮件中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下内容发送电子邮件:
I'm using the following to send an email:
<php ....
$message = 'Hi '.$fname.', \r\n Your entries for the week of '
.$weekof.' have been reviewed. \r\n Please login and View Weekly reports to see the report and comments. \r\n Thanks, \r\n'.$myname;
mail($to, $subject, $message, $from);
?>
收到消息后,它不会在\\\ 只是打印他们作为消息的一部分。
When the message is received it does not start a new line at the "\r\n" but just prints them as part of the message.
我只在Thunderbird 3中尝试过,而不是其他客户端。
I only tried it in Thunderbird 3, not any other clients.
推荐答案
尝试将您的'
更改为 - php解释一个字符串内单引号作为文字,而使用引号(
),它将扩展
\r\\\
Try to change your '
to "
- php interprets a string inside single quotes as literals, whereas with quotes ("
) it will expand the \r\n
to what you want.
更多信息: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
这篇关于换行不能在PHP邮件中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文