function Request::prepareBasePath
Prepares the 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 1856
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
protected function prepareBasePath() : string {
$baseUrl = $this->getBaseUrl();
if (!$baseUrl) {
return '';
}
$filename = basename($this->server
->get('SCRIPT_FILENAME'));
if (basename($baseUrl) === $filename) {
$basePath = \dirname($baseUrl);
}
else {
$basePath = $baseUrl;
}
if ('\\' === \DIRECTORY_SEPARATOR) {
$basePath = str_replace('\\', '/', $basePath);
}
return rtrim($basePath, '/');
}