搜索来的,我想用,贴出来,看有木有问题啊!
echo $HTTP_HOST
就是要输出的域名!
- 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 );
复制代码
|