【发布时间】:2009-12-14 10:27:24
【问题描述】:
当我加载 ZF 网站的主页时,我收到一条消息“指定的控制器无效(错误)”,其中“错误”似乎是控制器的名称。
在我的 bootstrap.php 中,我有下面的 sn-p,我在 catch() 中添加了 prints 语句:
// Dispatch the request using the front controller.
try {
$frontController->dispatch();
}
catch (Exception $exception) {
print $exception; exit;
exit($exception->getMessage());
}
打印出来:
exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /www/common/ZendFramework/library16/Zend/Controller/Dispatcher/Standard.php:241
Stack trace:
#0 /www/common/ZendFramework/library16/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 /www/site.com/htdocs/application/bootstrap.php(38): Zend_Controller_Front->dispatch()
#2 /www/site.com/htdocs/public/index.php(16): require('/www/site....')
#3 {main}
任何人都可以理解发生的事情吗?我有一种预感,这与区分大小写和 ZF 的命名约定有关。
最初的“无效控制器”消息来自下面的sn-p
print $request->getControllerName();
if (!$this->isDispatchable($request)) {
$controller = $request->getControllerName();
if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {
require_once 'Zend/Controller/Dispatcher/Exception.php';
throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')');
}
$className = $this->getDefaultControllerClass($request);
}
这一切都会打印出“indexerrorInvalid controller specified (error)”,所以看起来它正在尝试首先加载索引控制器,但不能,然后在加载错误控制器时出现问题。
会不会是控制器文件的路径不对?
【问题讨论】:
标签: zend-framework