Skip to content

Instantly share code, notes, and snippets.

@bitkorn
Last active December 13, 2016 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitkorn/b26bbd5fa968f2bc215e29c0da916ba7 to your computer and use it in GitHub Desktop.
Save bitkorn/b26bbd5fa968f2bc215e29c0da916ba7 to your computer and use it in GitHub Desktop.
<?php
$uri = $this->getRequest()->getUri();
$base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost());
// or
$serverUrlHelper = $this->getServiceLocator()->get('ViewHelperManager')->get('ServerUrl');
$url = $serverUrlHelper($this->url()->fromRoute('some_routename'));
// or in view
echo $this->serverUrl($this->url('some_routename'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment