问题描述
我正在读一本名为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?
推荐答案
这篇关于" \\\<br/>"用PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!