1
是否有可能通过使用zend方法重定向视图脚本?Zend在视图脚本中重定向
还是会只是简单的使用PHP重定向:
<?php header('Location: $myurl') ?>
是否有可能通过使用zend方法重定向视图脚本?Zend在视图脚本中重定向
还是会只是简单的使用PHP重定向:<?php header('Location: $myurl') ?>
在你的控制器(使用位置标头):
$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');
谢谢。这是我正在寻找的。 – chrisjlee 2011-06-08 13:06:16
1:是,2:第 – hakre 2011-06-08 04:00:59
定义“重定向视图脚本” – Phil 2011-06-08 04:02:09
@phil视图脚本 - 文件存在在'application/layouts/scripts'文件夹中。有时候控制器变量不在直接添加到$ this-> view方法中的范围内 – chrisjlee 2011-06-08 04:11:39