zend framework如何实现重定向

发布时间:2021-09-02 09:29:45 作者:小新
来源:亿速云 阅读:141

小编给大家分享一下zend framework如何实现重定向,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

具体如下:

一. render

不指定render

结果: {当前Module}/{当前Controller}/{当前Action}.phtml

$this->render('bar');

结果: {当前Module}/{当前Controller}/bar.phtml

二. forward

$this->_forward('bar');

结果: {当前Module}/{当前Controller}/bar

$this->_forward('bar', 'foo');

结果: {当前Module}/foo/bar

$this->_forward('bar', 'foo', 'hoge');

结果: hoge/foo/bar

$params = array(
 'a' => '1',
 'b' => '2'
);
$this->_forward('bar', 'foo', 'hoge', $params);

结果: /hoge/foo/bar/a/1/b/2

三. redirect

$this->_redirect('/hoge');

结果: /hoge

$this->_redirect('/hoge/foo');

结果: /hoge/foo

$this->_redirect('/hoge/foo/bar');

结果: /hoge/foo/bar

$this->_redirect('http://localhost/hoge/foo/bar');

结果: http://localhost/hoge/foo/bar

$this->_redirect('http://localhost/hoge/foo/bar?a=1&b=2');

结果: http://localhost/hoge/foo/bar?a=1&b=2

四. 特殊情况

不使用 layout

结果:

$this->_helper->layout()->disableLayout();

不使用 view

结果:

$this->_helper->viewRenderer->setNoRender();

以上是“zend framework如何实现重定向”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

推荐阅读:
  1. Zend Framework框架中如何实现Ajax
  2. Zend Framework怎么用

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

zend framework

上一篇:Zend Framework基本页面布局的示例分析

下一篇:Zend Framework框架路由机制的示例分析

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》