【问题标题】:zend framework bootstrap errorzend 框架引导错误
【发布时间】:2011-03-18 17:15:44
【问题描述】:

所以我将这一行添加到 bootstrap.php

protected function _initSetDefaultKeywords() {
     $view = $this->bootstrap('view')->getResource('view');        
     $view->keywords = 'default keywords';
}

但它会显示错误

Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found

所以我尝试将 resources.view[] = "" 添加到 application.ini,但是当这种情况发生时,我所有的视图助手突然停止工作

* s

An error occurred
Application error
Exception information:

    Message: Plugin by name 'X' was not found in the registry

我该如何解决这个问题

当前 app.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.frontController.defaultControllerName = "view"
resources.view[] = ""

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

【问题讨论】:

  • 您可以发布您当前的 application.ini 文件吗?

标签: php zend-framework bootstrapping


【解决方案1】:

在你的 application.ini 中试试这个:

resources.view[] = ""
resources.view.helperPath.MyNamespace_View_Helper = "MyNamespace/View/Helper"

确保将 MyNamespace_View_Helper 更改为 ViewHelpers 的实际前缀。

您可能还需要将路径添加到 AutoloaderNamespaces 变量:

autoloaderNamespaces.MyNamespace = "MyNamespace_"

【讨论】:

  • 第一行不需要配置,第二行设置视图资源的配置数组。
  • @Phil - 谢谢,我更想给@kamikaze_pilot 提供线路应该去哪里的参考。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多