换行符在 PHP 邮件中不起作用 [英] newline not working in PHP mail

查看:33
本文介绍了换行符在 PHP 邮件中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下内容发送电子邮件:

I'm using the following to send an email:

<php ....
$message = 'Hi '.$fname.', 
 Your entries for the week of '
   .$weekof.' have been reviewed. 
 Please login and View Weekly reports to see the report and comments. 
 Thanks, 
'.$myname;

mail($to, $subject, $message, $from);
?>

当收到消息时,它不会在 "处开始一个新行,而是将它们作为消息的一部分打印出来.

When the message is received it does not start a new line at the " " but just prints them as part of the message.

我只在 Thunderbird 3 中尝试过,没有在任何其他客户端中尝试过.

I only tried it in Thunderbird 3, not any other clients.

推荐答案

Try to change your ' to " - php 将单引号内的字符串解释为文字,而带引号 (") 它将把 扩展到你想要的.

Try to change your ' to " - php interprets a string inside single quotes as literals, whereas with quotes (") it will expand the to what you want.

更多信息:http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

这篇关于换行符在 PHP 邮件中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆