kam*_*lot 1 php bootstrapping zend-framework
所以我把这行添加到bootstrap.php
protected function _initSetDefaultKeywords() {
$view = $this->bootstrap('view')->getResource('view');
$view->keywords = 'default keywords';
}
Run Code Online (Sandbox Code Playgroud)
但那会显示错误
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource matching "view" not found
Run Code Online (Sandbox Code Playgroud)
所以我尝试添加resources.view[] = ""到application.ini,但是当发生这种情况时,我的所有视图助手突然停止工作
* s
An error occurred
Application error
Exception information:
Message: Plugin by name 'X' was not found in the registry
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题
目前的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
Run Code Online (Sandbox Code Playgroud)
在你的application.ini中尝试这个:
resources.view[] = ""
resources.view.helperPath.MyNamespace_View_Helper = "MyNamespace/View/Helper"
Run Code Online (Sandbox Code Playgroud)
确保更改MyNamespace_View_Helper为ViewHelpers的实际前缀.
您可能还需要添加AutoloaderNamespaces变量的路径:
autoloaderNamespaces.MyNamespace = "MyNamespace_"
Run Code Online (Sandbox Code Playgroud)