Reputation: 4061
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
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