PHP_EOL

PHP中除去换行符

$str = str_replace(array("\r\n", "\r", "\n"), "", $str);
$str = str_replace(PHP_EOL, '', $str); 

换行符

unix系列用 \n

windows系列用 \r\n

mac用 \r

PHP中可以用PHP_EOL来替代,以提高代码的源代码级可移植性

可以用函数get_defined_constants()来获取所有PHP常量

php常量:http://php.net/manual/zh/reserved.constants.php

posted @ 2016-04-18 19:40  冲锋号  阅读(177)  评论(0编辑  收藏  举报