Home >Backend Development >PHP Tutorial >php跨平台小结 常用预定义常量

php跨平台小结 常用预定义常量

WBOY
WBOYOriginal
2016-06-13 11:01:56783browse

php跨平台总结 常用预定义常量

?

<?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;}// *nixecho DIRECTORY_SEPARATOR; // /echo PHP_SHLIB_SUFFIX;    // soecho PATH_SEPARATOR;      // :// Win*echo DIRECTORY_SEPARATOR; // \echo PHP_SHLIB_SUFFIX;    // dllecho PATH_SEPARATOR;      // ;?> ?

if?(strtoupper(substr(PHP_OS,?0,?3))?===?'WIN')?{??? 得到操作系统类型

DEFAULT_INCLUDE_PATH? 得到php.ini中配置的include_path

Statement:
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