■エラーコントローラ
<?php require_once 'Zend/Controller/Action.php'; class ErrorController extends Zend_Controller_Action { public function errorAction(){ $response = $this->getResponse(); $response->setBody('Forbidden'); } }
デフォルトのアクションにリダイレクトする場合は以下のようになる。
<?php require_once 'Zend/Controller/Action.php'; class ErrorController extends Zend_Controller_Action { public function errorAction() { $response = $this->getResponse(); $response->setBody('Forbidden'); } public function __call($method, $args) { if(substr($method, -6) === 'Action'){ $controller = $this->getRequest()->getControllerName(); $url = '/' . $controller . '/index'; return $this->redirect($url); } } }