php - baseUrl View 助手不适用于 ZendFramework 2

标签 php zend-framework2

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

调试错误:

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 有 helper Zend\View\Helper\BasePath

在 View $this->basePath();

关于php - baseUrl View 助手不适用于 ZendFramework 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12866578/

相关文章:

php - Zend\Session\Container Session 验证失败异常 -- Object(Closure) ZF2

php - 保存到数据库时如何忽略空输入

java - 不同的 ascii 表代码值?

javascript - PHP传递参数给新的字符串(学习)

zend-framework2 - 按照添加的顺序循环遍历表单元素

php - 如何在 Zend Framework 2 中为变量值构建 ACL 断言?

mysql - 在 zend frame work 2 中选择一个带有虚拟值的虚拟列

php - sql选择过滤器和取消过滤器

PHP MYSQL 子串的使用方法

routes - 在 ViewHelper 中访问路由器以匹配路由或 child_routes