In my zf2 controller I want to retrieve the application base URL (for example http://example.com).
I tried the following call but it returns an empty string.
$this->request->getBasePath();
How can I then get the http://example.com part of URL in my controller?
I know this is not the prettiest way of doing it but, hey, it works:
Or if you don’t mind shortening everything you could do it in two lines: