- <?php
- /**
- * 获得用户操作系统的换行符
- *
- * @access public
- * @return string
- */
- function get_crlf()
- {
- /* LF (Line Feed, 0x0A, \N) 和 CR(Carriage Return, 0x0D, \R) */
- if (stristr($_SERVER['HTTP_USER_AGENT'], 'Win')){
- $the_crlf = '\r\n';
- }elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'Mac')){
- $the_crlf = '\r'; // for old MAC OS
- }else{
- $the_crlf = '\n';
- }
- return $the_crlf;
- }
- // *nix
- echo DIRECTORY_SEPARATOR; // /
- echo PHP_SHLIB_SUFFIX; // so
- echo PATH_SEPARATOR; // :
- // Win*
- echo DIRECTORY_SEPARATOR; // \
- echo PHP_SHLIB_SUFFIX; // dll
- echo PATH_SEPARATOR; // ;
- define('DS', DIRECTORY_SEPARATOR);
- define('PS', PATH_SEPARATOR);
- ?>
if ( strtoupper ( substr (PHP_OS, 0, 3)) === 'WIN' ) { 得到操作系统类型
DEFAULT_INCLUDE_PATH 得到php.ini中配置的include_path
$text = str_replace(array("\n", "\r", "\r\n"), "", $text);