Generates a normalized URI for the given path.
public getUriForPath ( string $path ) : string | ||
$path | string | A path to use instead of the current one |
return | string | The normalized URI for the path |
use Symfony\Component\HttpFoundation\Request; $request = Request::createFromGlobals(); $path = '/foo/bar'; $uri = $request->getUriForPath($path); // Output: https://example.com/foo/bar
use Symfony\Component\HttpFoundation\Request; $request = Request::createFromGlobals(); $path = '/foo/bar'; $uri = $request->getUriForPath('ftp:'.$path); // Output: ftp://example.com/foo/barThe HttpFoundation component is a part of the Symfony libraries, which is a set of reusable PHP components that help you build robust and scalable web applications.
public getUriForPath ( string $path ) : string | ||
$path | string | A path to use instead of the current one |
return | string | The normalized URI for the path |