什么时候使用 PHP 常量“PHP_EOL"? [英] When do I use the PHP constant "PHP_EOL"?

查看:33
本文介绍了什么时候使用 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 表示当前 系统.例如,它在类 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆