Zend framework 未捕获异常';Zend#u控制器#u调度程序#u异常';带有消息';无效的控制器类(“Error”Error“u ErrorController”)
我为我的项目创建了3个模块 像这样: 应用程序/模块/管理员 应用程序/模块/默认值 应用程序/模块/错误 每个模块都有自己的CNontroller、view、layout文件夹。默认模块中的一切都是正确的,但当我转到管理模块时,我看到了这个错误(www.domain.com/public/admin) 致命错误:在E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:347堆栈跟踪:#0 E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php(256):Zend\u Controller\Dispatcher\u Standard->loadClass('ErrorController')中出现未捕获的异常“Zend\u Controller\u Dispatcher\u exception”,消息“无效的控制器类(“error\u ErrorController”))#1 E:\xampp\php\PEAR\Zend\Controller\Front.php(946):Zend\u Controller\u Dispatcher\u Standard->dispatch(对象(Zend\u Controller\u Request\u Http)、对象(Zend\u Controller\u Response\u Http))#2 E:\Zend\u progamming\donyaye\u fan\u Zend\application\Bootstrap.php(110):Zend\u Controller\u Front->调度()#3 E:\Zend\u progamming\donyaye fan\u fan\u fan\u public\index.php(5):Bootstrap->runApp()#4{main}在第347行的E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php中抛出 这是与此错误相关的引导代码:Zend framework 未捕获异常';Zend#u控制器#u调度程序#u异常';带有消息';无效的控制器类(“Error”Error“u ErrorController”),zend-framework,module,error-handling,Zend Framework,Module,Error Handling,我为我的项目创建了3个模块 像这样: 应用程序/模块/管理员 应用程序/模块/默认值 应用程序/模块/错误 每个模块都有自己的CNontroller、view、layout文件夹。默认模块中的一切都是正确的,但当我转到管理模块时,我看到了这个错误(www.domain.com/public/admin) 致命错误:在E:\xampp\php\PEAR\Zend\Controller\Dispatcher\Standard.php:347堆栈跟踪:#0 E:\xampp\php\PEAR\Zend
$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'
)));
这是我的模块设置类:
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')));
}
}我找到了答案:在errorController中,必须将错误目录名放在类名之前,就像error\u errorControllererrorControl.php在您的控制器文件夹中不可用。如果该文件在其位置上可用,则会从errorControl.php文件中显示自定义错误 主要问题是:您的代码在php文件中有一些错误,所以程序正在搜索errorControl.php文件。如果您要从php文件中删除错误,则不会出现此错误