我在总体布局中具有值(value)。 我需要将此值设置为任何页面上的当前 url。 如何做到这一点?
谢谢大家
最佳答案
在 Zend Framework 2 中,您可以使用 Zend\View\Helper\ServerUrl View 助手。非常简单:
//for example, your current URI is: http://mydomain.com/page/sample/
//get your domain
$uri = $this->serverUrl(); // Output: http://mydomain.com
//get your current URI
$uri = $this->serverUrl(true); // Output: http://mydomain.com/page/sample/
了解更多:http://codingexplained.com/coding/php/zend-framework/create-full-urls-in-zf2-views
关于php - 采埃孚 : How to get current url on any page in the view?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5510958/