drupal_detect_baseurl
includes/install.inc, строка 133
- Версии
- 5 – 6
drupal_detect_baseurl($file = 'install.php')
Auto detect the base_url with PHP predefined variables.
Параметры
$file
The name of the file calling this function so we can strip it out of
the URI when generating the base_url.
Возвращаемое значение
The auto-detected $base_url
that should be configured in settings.php
Код
<?php
function drupal_detect_baseurl($file = 'install.php') {
global $profile;
$proto = $_SERVER['HTTPS'] ? 'https://' : 'http://';
$host = $_SERVER['SERVER_NAME'];
$port = ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'. $_SERVER['SERVER_PORT']);
$uri = preg_replace("/\?.*/", '', $_SERVER['REQUEST_URI']);
$dir = str_replace("/$file", '', $uri);
return "$proto$host$port$dir";
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии