我是靠谱客的博主 舒适棒棒糖,这篇文章主要介绍zend framework重定向方法小结,现在分享给大家,希望可以做个参考。

本文总结了zend framework重定向的方法。分享给大家供大家参考,具体如下:

一. render

不指定render

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

复制代码
1
$this->render('bar');

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

二. forward

复制代码
1
$this->_forward('bar');

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

复制代码
1
$this->_forward('bar', 'foo');

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

复制代码
1
$this->_forward('bar', 'foo', 'hoge');

结果: hoge/foo/bar

复制代码
1
2
3
4
5
$params = array( 'a' => '1', 'b' => '2' ); $this->_forward('bar', 'foo', 'hoge', $params);

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

三. redirect

复制代码
1
$this->_redirect('/hoge');

结果: /hoge

复制代码
1
$this->_redirect('/hoge/foo');

结果: /hoge/foo

复制代码
1
$this->_redirect('/hoge/foo/bar');

结果: /hoge/foo/bar

复制代码
1
$this->_redirect('http://localhost/hoge/foo/bar');

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

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

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

四. 特殊情况

不使用 layout

结果:

复制代码
1
$this->_helper->layout()->disableLayout();

不使用 view

结果:

复制代码
1
$this->_helper->viewRenderer->setNoRender();

更多关于zend相关内容感兴趣的读者可查看本站专题:《Zend FrameWork框架入门教程》、《php优秀开发框架总结》、《Yii框架入门及常用技巧总结》、《ThinkPHP入门教程》、《php面向对象程序设计入门教程》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于Zend Framework框架的PHP程序设计有所帮助。

最后

以上就是舒适棒棒糖最近收集整理的关于zend framework重定向方法小结的全部内容,更多相关zend内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(157)

评论列表共有 0 条评论

立即
投稿
返回
顶部