【发布时间】:2012-11-12 19:12:31
【问题描述】:
可能重复:
PHP: trying to create a new line with “\n”
line break help in PHP
您好,我一直在尝试使用 \n 东西回显到 PHP 中的新行,但它不起作用,我尝试将其分开,以防 PHP 感到困惑或其他原因,但它仍然无法正常工作,帮助!!
这是我的代码,你不需要知道全部:
以“id”为1,“sender”为“test”,“message”为“test”
echo($rows."\n");
while($rowarray = mysql_fetch_array($result)){
echo($rowarray["id"].") From: ".$rowarray["sender"]." - ".$rowarray["message"]."\n");
}
我希望它像这样打印出来:
1 (or how many rows there are)
1) From: test - test
我不知道我做错了什么。非常感谢帮助
【问题讨论】:
-
您在浏览器中查看输出吗?
-
在 html 中换行
,浏览器读取\interprit html 不是纯文本 -
您是否要在 HTML 文档中回显
\n?如果是,则需要改用<br>。
标签: php