westdc-zf1/application/default/controllers/ErrorController.php

46 lines
1.3 KiB
PHP
Executable File

<?php
class ErrorController extends Zend_Controller_Action
{
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
}
public function errorAction()
{
$errors = $this->_getParam('error_handler');
switch ($errors->type) {
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()->setRawHeader('HTTP/1.1 404 Not Found');
$title = "您所访问的页面未找到";
$content = '您所访问的页面未找到<br />
The page you requested was not found.';
break;
default:
// application error
$title = "服务器内部错误";
$content = '服务器开了小差,请稍后再试或联系管理员<br />
An unexpected error occurred. Please try again later.';
break;
}
// Clear previous content
$this->getResponse()->clearBody();
$this->view->title = $title;
$this->view->content = $content;
}
public function authorityAction(){
}
}