日期:2014-05-17  浏览次数:20518 次

PHP获取网站域名和地址的代码
http://www.jb51.net/article/15514.htm

	function PMA_getenv($var_name) {
		if (isset ( $_SERVER [$var_name] )) {
			return $_SERVER [$var_name];
		} elseif (isset ( $_ENV [$var_name] )) {
			return $_ENV [$var_name];
		} elseif (getenv ( $var_name )) {
			return getenv ( $var_name );
		} elseif (function_exists ( 'apache_getenv' ) && apache_getenv ( $var_name, true )) {
			return apache_getenv ( $var_name, true );
		}
		return '';
	}
	if (empty ( $HTTP_HOST )) {
		if (PMA_getenv ( 'HTTP_HOST' )) {
			$HTTP_HOST = PMA_getenv ( 'HTTP_HOST' );
		} else {
			$HTTP_HOST = '';
		}
	}
	//echo htmlspecialchars($HTTP_HOST );