来自mySQL的PHP电子邮件中的换行符


Line breaks in PHP email from mySQL

除了不为每个结果拆分为单独的行之外,我还有以下代码可以工作。

<?php>
$result = mysql_query("SELECT * FROM lending");
 //fetch the data from the database 
$entries = 'Entries: '; 
while ($row = mysql_fetch_array($result)) {
$entries .= $row['bookname'] . ', "/r"';
}
{
?>
// In case any of our lines are larger than 70 characters, we should use wordwrap()
//$entries = wordwrap($entries, 70, "'r'n");
// Send
mail('me@example.com', 'My Subject', $entries);
?>

当我运行此程序时,我收到一封电子邮件,内容如下:

条目:测试ASIN,"''r"测试ASIN

我应该把"/r"放在哪里才能正确解析它?还是应该是"/n/r"?

谢谢!

Alex

看起来代码有/r而不是''r。