How to get the path of the request in symfony2
15,397
$request->getUri()
returns the absolute URL => http://example.com/app.php/path
$request->getRequestUri()
returns the absolute path => /app.php/path
$request->getPathInfo()
returns the path corresponding to your controller's action => /path
getPathInfo
just subtracts the executed script (/app.php) from the request URI, so it returns the path relative to the executed script.
Author by
user2268997
Updated on June 04, 2022Comments
-
user2268997 almost 2 years
I know of the method
\Symfony\Component\HttpFoundation\Request::getPathInfo()
however in the docs it states that, that only returns the path of the request which is "relative" to the "executed script".How can I get the full path?and on a second note what does 'executed script' mean when all requests are going through the front controller?