什么时候使用PHP常量"PHP_EOL"? [英] When do I use the PHP constant "PHP_EOL"?
本文介绍了什么时候使用PHP常量"PHP_EOL"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么时候使用 PHP_EOL
是个好主意?
When is it a good idea to use PHP_EOL
?
我有时会在PHP的代码示例中看到这一点.这样可以处理DOS/Mac/Unix终端问题吗?
I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?
推荐答案
是的,表面上PHP_EOL
用于以跨平台兼容的方式查找换行符,因此它可以处理DOS/Unix问题.
Yes, PHP_EOL
is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Unix issues.
请注意, PHP_EOL 表示 current 系统.例如,在类似Unix的系统上执行时,它将找不到Windows终端行.
Note that PHP_EOL represents the endline character for the current system. For instance, it will not find a Windows endline when executed on a unix-like system.
这篇关于什么时候使用PHP常量"PHP_EOL"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文