public function index20Action() { echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>"; $serverURL = new \Zend\View\Helper\ServerUrl(); //getHost() echo $serverURL->getHost() . "<br />"; //getPort() echo $serverURL->getPort() . "<br />"; //getScheme() echo $serverURL->getScheme() . "<br />"; $this->layout("layout/mvc"); return false; }
/** ServerUrl (only call in Controller ) */ public function index20Action() { $serverUrl = new \Zend\View\Helper\ServerUrl(); /** getHost */ echo $serverUrl->getHost(); /** getPort */ echo $serverUrl->getPort(); /** getScheme */ echo $serverUrl->getScheme(); $this->layout('layout/layout'); }