2011-04-09 25 views
1

我创建3模块,用于我的凸出 像这样:未捕获的异常 'Zend_Controller_Dispatcher_Exception' 与消息“无效控制器类( “Error_ErrorController”)

应用程序/模块/管理

应用程序/模块/默认

应用程序/模块/错误

每个模块都有自己的cnotroller,view,layout文件夹。每一个事情是默认的模块正确的,但是当我去管理模块,我看到了这个错误(www.domain.com/public/admin)

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller class ("Error_ErrorController")' in E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:347 Stack trace: #0 E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(256): Zend_Controller_Dispatcher_Standard->loadClass('ErrorController') #1 E:\xampp\php\PEAR\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #2 E:\zend_progamming\donyaye_fan_zend\application\Bootstrap.php(110): Zend_Controller_Front->dispatch() #3 E:\zend_progamming\donyaye_fan_zend\public\index.php(5): Bootstrap->runApp() #4 {main} thrown in E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php on line 347

这是一个与此有关的错误我引导代码:

$frontController->addModuleDirectory(ROOT_DIR . '/application/modules'); 
$frontController->setDefaultModule('default'); 
$frontController->registerPlugin(new Places_Controller_Plugin_ModuleSetup()); 
$frontController->registerPlugin(new Zend_Controller_Plugin_ErrorHandler(array(
     'module'  => 'error', 
     'controller' => 'error', 
     'action'  => 'error' 
    ))); 

,这是我modulesetup类:

class Places_Controller_Plugin_ModuleSetup extends Zend_Controller_Plugin_Abstract{ public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request) 
{ 

    // Set the layout directory for the loaded module 
    $layoutPath = ROOT_DIR . '/application/modules/' . $request->getModuleName() . '/layouts/scripts/'; 
    Zend_Layout::startMvc(array('layoutPath' =>$layoutPath)); 

    $autoloader = new Zend_Application_Module_Autoloader(array(
     'namespace' => '', 
     'basePath' => ROOT_DIR . "/modules/", 
    )); 
    $autoloader->addResourceTypes(array(
    'admin' => array(
      'path'  => 'admin/', 
      'namespace' => 'admin' 
     ), 
     'error' => array(
      'path'  => 'error/', 
      'namespace' => 'error'))); 

} 

}

回答

3

我找到了答案:在errorController必须把错误目录名称befor类名称,如error_errorController

0

errorControl.php不可用在您的控制器文件夹中。如果这个文件将在他们的地方可用,自定义错误将从errorControl.php文件中显示。

主要问题是:你的代码在php文件中有一些错误,所以程序正在搜索errorControl.php文件。如果你会从php文件中删除错误,这个错误不会来。

相关问题