shuba.ivan
shuba.ivan

Reputation: 4061

Symfony UrlGeneratorInterface::ABSOLUTE_URL

Symfony 2.6.11 I need base url I use UrlGeneratorInterface::ABSOLUTE_URL

$base_url = UrlGeneratorInterface::ABSOLUTE_URL;

and have true, but I need url How I can get base URL?

Upvotes: 2

Views: 2725

Answers (1)

Andriy Kuba
Andriy Kuba

Reputation: 8263

You can generate url from the request

$baseurl = $request->getScheme() . '://' . $request->getHttpHost() . $request->getBasePath();

UrlGeneratorInterface is just an interface that URL generator classes must implement (within symphony). And ABSOLUTE_URL is just a constant that trivially used in the parameters to point a method to generate an absolute URL

Upvotes: 2

Related Questions