本文介绍了PHP Echo换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
\ n和\ r(我知道它与操作系统有关)之间有什么区别?回声在跨平台上工作的换行符的最佳方法是什么?
What's the difference between \n and \r (I know it has something to do with OS), and what's the best way to echo a line break that will work cross platform?
作为对Jarod的回应,我将使用ths在.txt日志文件中回显换行符,尽管我确定以后会在其中使用它.诸如在页面上回显HTML makup之类的东西.
In response to Jarod, I'll be using ths to echo a line break in a .txt log file, though I'm sure I'll be using it in the future for things such as echoing HTML makup onto a page.
推荐答案
-
\n
是Linux/Unix换行符. -
\r
是经典的Mac OS(非OS X)换行符. Mac OS X使用上述unix\n
. -
\r\n
是Windows的换行符. \n
is a Linux/Unix line break.\r
is a classic Mac OS (non-OS X) line break. Mac OS X uses the above unix\n
.\r\n
is a Windows line break.
我通常只在我们的Linux系统上使用\n
,而且大多数Windows应用程序都可以正常使用它.
I usually just use \n
on our Linux systems and most Windows apps deal with it ok anyway.
这篇关于PHP Echo换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!