我一直在为Zend框架应用程序的新安装工作而努力,但是我无法弄清楚发生了什么。我有两个自定义操作助手想要使用,并且想要在引导程序中初始化它们。但似乎我的_init函数根本没有被调用。在启动应用程序的index.php文件中,我有以下代码:
require('Zend/Application.php');
$app = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH
.'/configs/application.ini');
$app->bootstrap()->run();
这是我在application.ini文件中的内容:
[production]
appnamespace = "Application_Name"
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = "/home/user/website/includes/library/Application_Name/Resource/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =
autoloaderNamespaces[] = "Application_Name"
pluginPaths.Application_Name_Resource = "Application_Name/Resource"
我知道这个应用程序在某种程度上是工作的,因为它使用了我拥有的布局,我可以在控制器和视图中进行操作,并将其输出到页面。我还知道它至少正在查看Bootstrap文件,因为当我省略一个结束大括号时,我可以让PHP出现错误。
以下是我的Bootstrap文件的一部分:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function _init()
{
Zend_Controller_Action_HelperBroker::addPrefix(new Application_Name_Controller_Action_Helper_ResourceInjector());
Zend_Controller_Action_HelperBroker::addPrefix(new Application_Name_Controller_Action_Helper_Em());
}
有什么想法是为什么会这样,或者我在配置中弄错了什么?我看了几十个关于如何配置Zend的教程,但似乎没有人遇到这个问题。
Bootstrap.php
位置是APPLICATION_PATH "/Bootstrap.php"
。您更改了它的原因是什么? - Phil