Uncaught exception 'Zend_Controller_Dispatcher

2019-02-07 08:38发布

I am getting the following error on zend framework:

Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in F:\wamp\www\helloworld\library\Zend\Controller\Dispatcher\Standard.php:245 
Stack trace: 
#0 F:\wamp\www\helloworld\library\Zend\Controller\Front.php(946):Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))  
#1 F:\wamp\www\helloworld\library\Zend\Controller\Front.php(212): Zend_Controller_Front->dispatch()  
#2 F:\wamp\www\helloworld\web_root\index.php(10): Zend_Controller_Front::run('../application/...')  
#3 {main} thrown in F:\wamp\www\helloworld\library\Zend\Controller\Dispatcher\Standard.php on line 245

What is causing this, and how can I fix it?

6条回答
放荡不羁爱自由
2楼-- · 2019-02-07 08:51

I got a same error ,and then i find out the reason,it's just a syntax error in my code.

查看更多
劫难
3楼-- · 2019-02-07 08:57

In index.php file write

$frontController->setParam('useDefaultControllerAlways', true);
$frontController->dispatch();

Alternatively you can write following line in [production] section of application.ini file:

resources.frontController.params.useDefaultControllerAlways = 1

查看更多
叛逆
4楼-- · 2019-02-07 08:58

Zend is looking for the Controller in the normal controllers dir. So Set this config

resources.frontController.defaultModule = "Default"

and create your Default_ErrorController class in the Default Module dir.

it will work fine

查看更多
放我归山
5楼-- · 2019-02-07 09:01

Zend is looking for the view script inside the /application/views/scripts directory. If you do not want to use automatic rendering, then in the controller class use:

public function init()
{
    $this->_helper->viewRenderer->setNoRender();
}

This will stop automatic rendering and your problem will be solved.

查看更多
乱世女痞
6楼-- · 2019-02-07 09:11

You have probably (re)moved/edited the ErrorController.php file, which can be found in

/application/controllers/

An other possibility is that you have configured your application to look after an not-existing Error controller.

查看更多
我命由我不由天
7楼-- · 2019-02-07 09:17

Main problem is not your errorController.php file. Main problem is error in your code if code will be free from error, your code will not ask about errorController.php

In your controller file action just put die("stop execution"); from top to bottom after each statement

you will find out a statement, who is responsible for this error. just rectify this error

查看更多
登录 后发表回答