2

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?

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.