欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

PHP_EOL

换行符

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()返回所有常量数组

更多请参考:http://cn.php.net/manual/en/reserved.constants.php

来自 http://www.cnblogs.com/codefor/archive/2011/06/18/2084300.html

普通分类: