是新行= \ n或\ r \ n吗? [英] Is a new line = \n OR \r\n?
本文介绍了是新行= \ n或\ r \ n吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看到许多开发人员使用不同的方法用新行分割字符串,但是我很困惑,这是正确的:\r\n
或\n
仅?
I've seen many developers use different methods to split a string by new lines, but i'm confused which is the correct: \r\n
OR \n
only?
推荐答案
\n
用于Unix系统(包括Linux和OSX).
\n
is used for Unix systems (including Linux, and OSX).
\r\n
主要在Windows上使用.
\r\n
is mainly used on Windows.
\r
用于真正的旧Mac.
\r
is used on really old Macs.
PHP_EOL
常量代替这些字符,以实现平台之间的可移植性.
PHP_EOL
constant is used instead of these characters for portability between platforms.
这篇关于是新行= \ n或\ r \ n吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文