protected function Request::prepareBasePath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request::prepareBasePath()
Prepares the base path.
Return value
string base path
1 call to Request::prepareBasePath()
- Request::getBasePath in vendor/
symfony/ http-foundation/ Request.php - Returns the root path from which this request is executed.
File
- vendor/
symfony/ http-foundation/ Request.php, line 1788
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
protected function prepareBasePath() {
$filename = basename($this->server
->get('SCRIPT_FILENAME'));
$baseUrl = $this
->getBaseUrl();
if (empty($baseUrl)) {
return '';
}
if (basename($baseUrl) === $filename) {
$basePath = dirname($baseUrl);
}
else {
$basePath = $baseUrl;
}
if ('\\' === DIRECTORY_SEPARATOR) {
$basePath = str_replace('\\', '/', $basePath);
}
return rtrim($basePath, '/');
}