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

WBOY
Release: 2016-05-17 08:54:24
Original
1127 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:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!