&QUOT; \\\<br/>&QUOT;用PHP [英] &quot;\n&quot; in PHP

查看:62
本文介绍了&QUOT; \\\<br/>&QUOT;用PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读一本名为PHP,Apache,MySQL Web Development的书。
http://www.wrox.com/WileyCDA/WroxTit...764557440.html


及其示例代码有时会有一个\ n在里面。它开车了我疯了因为php会忽略\ n,所以我不知道为什么这本书

将它们放在那里。有人知道吗?


例如:

if(mysql_num_rows($ result))

{

echo"< div class = \" scroller \"> \ n" ;;

while($ row = mysql_fetch_array($ result))

{

echo"< span class =''commentname''>" ;.

htmlspecialchars($ row [''name'']) 。

"< / span>< span class =''commentdate''>

("。date(" 1 F j,YH: i,strtotime($ row [''comment_date'']))。

")< / span> \ n" ;;


echo"< p class =''commenttext''> \ n"。

nl2br(htmlspecialchars($ row [''comment'']))。

" \ n< / p> \ n";

}

echo"< / div> \ n";

}

echo"< br /> \ n";


为什么这本书放了\ n在那里?

I am reading a book called "PHP, Apache, MySQL Web Development"
http://www.wrox.com/WileyCDA/WroxTit...764557440.html

and in its example code it sometimes will have a "\n" in it. It is driving
me crazy because php will ignore the "\n"s so i have no idea why this book
has them in there. Does anybody know?

For example:
if (mysql_num_rows($result))
{
echo "<div class=\"scroller\">\n";
while ($row = mysql_fetch_array($result))
{
echo "<span class=''commentname''>".
htmlspecialchars($row[''name'']).
"</span><span class=''commentdate''>
(". date("1 F j, Y H:i", strtotime($row[''comment_date''])).
")</span>\n";

echo "<p class=''commenttext''>\n".
nl2br(htmlspecialchars($row[''comment''])).
"\n</p>\n";
}
echo "</div>\n";
}
echo "<br />\n";

Why does the book put the "\n"s in there?

推荐答案

结果))

{

echo"< div class = \" scroller \ "> \ n";

while(
result))
{
echo "<div class=\"scroller\">\n";
while (


row = mysql_fetch_array(
row = mysql_fetch_array(


result))

{

echo"< span class =''commentname''>" ;.

htmlspecialchars(
result))
{
echo "<span class=''commentname''>".
htmlspecialchars(


这篇关于&QUOT; \\\<br/>&QUOT;用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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