baseUrl view helper not working on ZendFramework 2

2019-07-17 06:06发布

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条回答
The star\"
2楼-- · 2019-07-17 06:30

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

in the view $this->basePath();

查看更多
登录 后发表回答