【问题标题】:Zend Framework Plugin in INI is not runINI 中的 Zend Framework 插件未运行
【发布时间】:2010-07-27 15:17:35
【问题描述】:

我的 application.ini 文件中声明的插件没有被触发。我可以通过 Bootstrap 文件以旧方式安装插件,但我更愿意将其保留在 INI 中。它永远不会加载那个文件,没有抛出异常,什么都没有。

我尝试在声明中添加.class,但没有。

application.ini

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
phpSettings.date.timezone = "America/Chicago"

includePaths.library = APPLICATION_PATH "/../library:/Users/shane/Sites/doctrine1/lib"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
;resources.modules = ""

resources.frontcontroller.defaultmodule = default
resources.frontcontroller.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.displayExceptions = 1
resources.doctrine.connections.default.dsn = "mysql://root:root@127.0.0.1/newfb"
resources.doctrine.manager.attributes.attr_model_loading = "model_loading_zend"
;resources.doctrine.manager.attributes.attr_use_native_enum = true
pluginpaths.ZFDoctrine_Application_Resource = "ZFDoctrine/Application/Resource"
autoloadernamespaces.0 = "Doctrine"
autoloadernamespaces.1 = "ZFDoctrine"
autoloadernamespaces.2 = "dummy"
autoloadernamespaces.3 = "ZFDebug"

resources.frontController.params.prefixDefaultModule = false

;; This should work, but it doesn't, not sure why
resources.frontController.plugins.messages = "dummy_Plugins_Messages"

library/dummy/Plugins/Messages.php

<?php

class dummy_Plugins_Messages extends Zend_Controller_Plugin_Abstract
{
public function  preDispatch(Zend_Controller_Request_Abstract $request) {
    parent::preDispatch($request);

    throw new Exception('HERE');

}

}

index.php 是使用 Zend_Tool 创建的标准 Zend_Application

【问题讨论】:

    标签: php zend-framework plugins configuration


    【解决方案1】:

    您是否已将“Faxxbachs_Plugins”命名空间注册为插件路径?

    pluginpaths.Faxxbachs_Plugins = /path/to/Faxxbachs/Plugins
    

    另外仅供参考,我注意到在您的示例中,您的 frontController 大小写不一致。 ZF 倾向于对大小写发牢骚,因此请确保您始终如一。

    【讨论】:

    • 您在这两个帐户上都是对的。在我将案例从frontcontroller 固定到frontController 并添加pluginpaths 之后,它开始像魅力一样工作。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多