baseUrl view helper not working on ZendFramework 2

淺唱寂寞╮ 提交于 2019-12-11 02:40:27

问题


I'm testing with the new Zend Framework 2, and I found a problem when trying to use the baseUrl view helper, I'm getting the following error when calling $this->baseUrl() inside my phtml view file;

Debug Error:

C:\Zend\ZendServer\share\ZendFramework2\library\Zend\ServiceManager\ServiceManager.php line 424 - Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 'Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for baseUrl' in C:\Zend\ZendServer\share\ZendFramework2\library\Zend\ServiceManager\ServiceManager.php:424


回答1:


This looks like ZF1 feature, ZF2 has helper Zend\View\Helper\BasePath

in the view $this->basePath();



来源:https://stackoverflow.com/questions/12866578/baseurl-view-helper-not-working-on-zendframework-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!