是否可以使用zend方法重定向视图脚本?
或者使用php重定向会更简单:<?php header('Location: $myurl') ?>
答案 0 :(得分:7)
在您的控制器中(使用位置标题):
$this->_redirect($url);
或
$redirector = $this->getHelper('Redirector');
/* @var $redirector Zend_Controller_Action_Helper_Redirector */
$redirector->gotoUrl($url);
你也可以使用:
$redirector->gotoRoute(
array(
'action' => 'my-action',
'controller' => 'my-controller'
)
);
如果要使用与默认值不同的视图脚本:
$this->renderScript('/my-controller/my-view.phtml');