本人新学PHP,请教大家,print("<B>counter is $counter</B><BR>\n");这句话换行是靠<BR>还是\n
帮我解决这个之后麻烦再告诉我这两个分别是干什么的 ,期待好心人来

解决方案 »

  1.   

    <br />是html标签,在页面中产生一个换行;\n是转义字符,用来输出ASCII字符集中不可见的字符,print("\n");会在代码中输出一个换行符。
    “新人”必学:
    http://www.w3school.com.cn/xhtml/index.asp
    http://cn.php.net/manual/zh/
      

  2.   

    <?php
    echo "<div>1<br />1</div>";
    echo "<div>1\n1</div>";
    ?>
    右键->查看源文件(源代码)
      

  3.   

    你在\n前加入123如print("<B>counter is $counter</B><BR>123\n");就知道\n它没有换行的功能了,它就像是普通字符一样
      

  4.   

    \n是对html代码起换行作用,对html显示内容无换行作用查看源代码时
    <B>counter is counter</B><BR>\n<B>counter is counter</B><BR>
    显示为
    <B>counter is counter</B><BR>
    <B>counter is counter</B><BR><B>counter is counter</B><BR><B>counter is counter</B><BR>
    显示为
    <B>counter is counter</B><BR><B>counter is counter</B><BR>
    另外
    print("<B>counter is $counter</B><BR>\n");
    建议写作
    echo '<B>counter is ',$counter,'</B><BR>',PHP_EOL;至于为什么这样写,自己去学习一下,有助你记忆
      

  5.   

    哎呀呀,看到<B></B>就囧了,看到<BR>就更情何以堪了……LZ在看哪本书?很老了吧?你至少写成<strong>...</strong>... <br/>呀!