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

46 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2011-09-20 07:05:48 +00:00
<?php
class ErrorController extends Zend_Controller_Action
{
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->db=Zend_Registry::get('db');
}
2011-09-20 07:05:48 +00:00
public function errorAction()
{
$errors = $this->_getParam('error_handler');
2011-09-20 07:05:48 +00:00
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
2011-09-20 07:05:48 +00:00
// 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.';
2011-09-20 07:05:48 +00:00
break;
default:
2011-09-20 07:05:48 +00:00
// application error
$title = "服务器内部错误";
$content = '服务器开了小差,请稍后再试或联系管理员<br />
An unexpected error occurred. Please try again later.';
2011-09-20 07:05:48 +00:00
break;
}
// Clear previous content
$this->getResponse()->clearBody();
$this->view->title = $title;
2011-09-20 07:05:48 +00:00
$this->view->content = $content;
}
public function authorityAction(){
}
2011-09-20 07:05:48 +00:00
}