Home > Backend Development > PHP Tutorial > php中的PHP_EOL换行符详细解析_php实例

php中的PHP_EOL换行符详细解析_php实例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-17 08:54:24
Original
1263 people have browsed it

在unix系列用 \n
在windows系列用 \r\n
在mac用 \r
PHP中可以用PHP_EOL来替代,以提高代码的源代码级可移植性

比如: 

复制代码 代码如下:

    echo PHP_EOL;
       //windows平台相当于    echo "\r\n";
       //unix\linux平台相当于    echo "\n";
       //mac平台相当于    echo "\r";

我们可以用函数get_defined_constants()来获取所有PHP常量。
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template