开发者

how can redirect after a dispatcher exception?

开发者 https://www.devze.com 2022-12-08 14:30 出处:网络
On zend framework inside my bootstrap file i have the following code: $frontController = Zend_Controller_Fron开发者_C百科t::getInstance();

On zend framework inside my bootstrap file i have the following code:

$frontController = Zend_Controller_Fron开发者_C百科t::getInstance(); 

try 
{
    $front->dispatch();
} 
catch (Exception $e) 
{
    echo "Something wrong happen";
}

Instead the ugly message i want to redirect to a custom controller... how can i do that if i can not use $frontController to redirect .... ?

Thanks for your help..


Zend will redirect to ErrorController if it is set.

By default, Zend_Controller_Plugin_ErrorHandler will forward to ErrorController::errorAction()

See Section 12.10.5.2.


ZendFramework has a helper class for handling redirects.

Sample usage (from your controller):

$redirectHelper = $this->_helper->getHelper('Redirector');
$redirectHelper->gotoUrl('controller/action');

You can also call redirect directly from your controller, i.e.

$this->_redirect($url);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号