Zend framework autoloader在我的Zend Framework应用程序中找不到帮助器类

Zend framework autoloader在我的Zend Framework应用程序中找不到帮助器类,zend-framework,helpers,Zend Framework,Helpers,我有一个问题,在我的ZF应用程序中,无法加载操作助手。错误消息是: 找不到名为Sunshine的操作帮助程序 我的ZF应用程序的布局使用模块,其中我具有以下结构: application modules weather controllers helpers 我已经在位于的模块引导中注册了帮助程序 application -> modules -> weather -> Bootstrap.php 这是密码 &

我有一个问题,在我的ZF应用程序中,无法加载操作助手。错误消息是:

找不到名为Sunshine的操作帮助程序

我的ZF应用程序的布局使用模块,其中我具有以下结构:

application
   modules
      weather
          controllers
             helpers
我已经在位于的模块引导中注册了帮助程序

application -> modules -> weather -> Bootstrap.php
这是密码

<?php
class Weather_Bootstrap extends Zend_Application_Module_Bootstrap
{

    protected function _initActionHelperBrokers()
    {
        Zend_Controller_Action_HelperBroker::addPath('controllers/helpers', 'Weather_Controllers_Action_Helper_');
    }
}


<?php
class Weather_Controller_Action_Helper_Sunshine extends Zend_Controller_Action_Helper_Abstract 
{

    public function getSunrise() 
    {
        return "06:00";
    }

}

<?php
class Weather_ForecastsController extends Zend_Controller_Action
{

    protected function getForecasts($date) 
    {
        $sunrise = $this->_helper->Sunshine->getSunrise();
        // tbc
    }

方法需要指向helper目录的整个路径。将其更改为:

Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/modules/weather/controllers/helpers', 'Weather_Controllers_Action_Helper_');
或者,您也可以通过application.ini添加路径:

resources.frontController.actionhelperpaths.Weather_Controllers_Action_Helper = APPLICATION_PATH "/modules/weather/controllers/helpers"

嗯,我尝试了完整的路径,但结果是一样的。还有什么可能出错?请确保路径实际上已在helperBroker中注册。将
Zend\u Debug::dump($this->\u helper)
添加到
getforecast()
方法中,并检查路径是否已注册(并且正确)。我发现模块引导未执行。我将addPath方法放在常规引导程序中,并使用调试器将其放入其中,以确保它实际执行。的确如此。所以我得到了调试消息,但是尽管我已经看到路径被正确地添加到插件注册表中,但它并没有显示在调试消息的某个地方。我发现了问题,它是一个愚蠢的打字错误(在类名中漏掉了一个字母)。另外,未加载模块引导映射的问题是由于application.ini(resources.modules[]=“”)中的模块缺少空数组造成的。