換行符
unix系列用 \n
windows系列用 \r\n
mac用 \r
PHP中可以用PHP_EOL來替代,以提高代碼的源代碼級可移植性
如:
1
2
3
4
5
|
<?php
echo
PHP_EOL;
//windows平台相當於 echo "\r\n";
//unix\linux平台相當於 echo "\n";
//mac平台相當於 echo "\r";
|
類似常用的還有
DIRECTORY_SEPARATOR
可以用函數get_defined_constants()來獲取所有PHP常量
1
2
|
<?php
print_r(get_defined_constants());
//get_defined_constants()返回所有常量數組
|
get_defined_constants 返回所有常量數組
參考鏈接:https://www.cnblogs.com/codefor/archive/2011/06/18/2084300.html