[PHP] Line breaks in different environments

php 不同系统之间换行的实现是不一样的

* linux 与unix中用  /n
* window 为了体现与linux不同 则是  /r/n
* mac 用  /r

 windows:

echo "我对我的梦有种迷恋";
echo "\n";
echo "大于痛苦大于这世界";
echo "\r";
echo "就像只有一颗星的夜";
echo "\r\n";
echo "它的闪耀 它的孤单";
echo "<br>";
echo "不用被看见";
  • The web browsing results are as follows:

Visible: When the web browser is only <br> the entry into force of

  • The results of viewing the source code of the webpage are as follows:

Visible: the source code \ r is not the entry into force of

 

  • The function of \n is to wrap the source code. If you look at the html source code, you will see that there is a newline, and the browser considers it to be useless, so it will be displayed the same whether it is used or not.
  • If it is output to the browser, use <br/>
  • If it is output to your own file, use " \n ", under Windows it is" \r\n "

 

Well, "Night of a Star", a very nice song

Guess you like

Origin blog.csdn.net/I_lost/article/details/105296783