baseUrl 视图助手不适用于 ZendFramework 2 [英] baseUrl view helper not working on ZendFramework 2

查看:26
本文介绍了baseUrl 视图助手不适用于 ZendFramework 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用新的 Zend Framework 2 进行测试,在尝试使用 baseUrl 视图助手时发现了一个问题,调用 $this->baseUrl() 时出现以下错误在我的 phtml 视图文件中;

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;

调试错误:

C:\Zend\ZendServer\share\ZendFramework2\library\Zend\ServiceManager\ServiceManager.php第 424 行 - 未捕获的异常带有消息的Zend\ServiceManager\Exception\ServiceNotFoundException"'Zend\ServiceManager\ServiceManager::get 无法获取或创建baseUrl' 中的一个实例C:\Zend\ZendServer\share\ZendFramework2\library\Zend\ServiceManager\ServiceManager.php:424

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

推荐答案

这个看起来像 ZF1 的特性,ZF2 有帮助 Zend\View\Helper\BasePath

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

在视图中 $this->basePath();

in the view $this->basePath();

这篇关于baseUrl 视图助手不适用于 ZendFramework 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆