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

php中的PHP_EOL换行符详细解析_PHP

WBOY
WBOYOriginal
2016-06-01 12:00:06853browse

在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常量。

Statement:
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