开发者

Zend redirect in a view script

  1. Is it possible to redirect a view script via usi开发者_StackOverflowng a zend method ?

  2. Or would it just be simpler to use a php redirect: <?php header('Location: $myurl') ?>


In your controller (use location header):

$this->_redirect($url);

or

$redirector = $this->getHelper('Redirector');
/* @var $redirector Zend_Controller_Action_Helper_Redirector */
$redirector->gotoUrl($url);

you can also use:

$redirector->gotoRoute(
    array(
        'action'     => 'my-action',
        'controller' => 'my-controller'
    )
);

If you want to use a different view script than the default:

$this->renderScript('/my-controller/my-view.phtml');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜