1
Zend Framework 1中存在404錯誤的問題。http://www.url.nl/path/wrong返回404錯誤(因爲存在/path
部分)。但是當第一個路徑錯誤(根目錄)時,它會返回一個500錯誤。所以http://url.nl/wrong返回500.任何人遇到同樣的問題?這是我的錯誤處理程序:Zend:500錯誤而不是404
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
// 404 error -- controller or action not found
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found '.$role;
if (!$role) $this->_helper->layout->setLayout ('pages/404');
else $this->_helper->layout->setLayout ('404');
break;
default:
// application error
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
if ($errors->exception instanceof Zend_Acl_Exception) {
// send needed headers...
// prepare log message...
// render info: resource_not_found.phtml
$this->_helper->viewRenderer('error-no-access');
$this->_helper->layout->setLayout ('403');
}
編輯: 的ACL經理的問題,包含在重定向等一些問題,其中大部分重定向到後端和限制,因爲普通用戶試圖頁面到達頁面。
謝謝,忘了在這裏提到它,但ACL管理器是問題。前程序員擴展了Zend的ACL管理器,它包含一些錯誤 –