我正在使我的 bootstrap.php 文件更有条理,但是在将所有内容放入单独的静态方法之后,我无法加载索引控制器之外的任何页面。例如,如果我尝试打开
http://localhost/zftutorial/login/index
我明白了
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message
'Invalid controller class ("Login_IndexController")' in C:\Program
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php:341
Stack trace: #0 C:\Program
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php(255):
Zend_Controller_Dispatcher_Standard->loadClass('IndexController') #1 C:\Program
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Front.php(934):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http)) #2 C:\Program
Files\VertrigoServ\www\zftutorial\public\index.php(18): Zend_Controller_Front->dispatch()
#3 C:\Program Files\VertrigoServ\www\zftutorial\public\index.php(138): Bootstrap::run() #4
{main} thrown in C:\Program
Files\VertrigoServ\www\library\Zend\library\Zend\Controller\Dispatcher\Standard.php on
line 341
在我的引导文件中,我似乎已经定义了应该在哪里找到控制器:
public static function setupFrontController()
{
self::$frontController = Zend_Controller_Front::getInstance();
self::$frontController->throwExceptions(true);
self::$frontController->returnResponse(true);
self::$frontController->setBaseUrl('/zftutorial');
self::$frontController->setControllerDirectory(
array(
'default' => self::$root . '../application/controllers',
'admin' => self::$root . '../application/controllers',
'index' => self::$root . '../application/controllers',
'login' => self::$root . '../application/controllers',
'user' => self::$root . '../application/controllers'
)
);
self::$frontController->setParam('registry', self::$registry);
}
也许它与路由有关,但我的应用程序以前在隐式路由方面工作得很好,例如其他控制器也工作得很好。上述错误的根源是什么?我该如何测试/查找/修复它?