转:Zend Framework 重定向方法(render, forward, redirect)
2012-06-20 14:16
337 查看
一. 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() ;
------------------------------------------------------------------------------------
转自:http://my.opera.com/jlake/blog/2009/08/04/zend-framework-render-forward-redirect
不指定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() ;
------------------------------------------------------------------------------------
转自:http://my.opera.com/jlake/blog/2009/08/04/zend-framework-render-forward-redirect
相关文章推荐
- zend framework 重定向方法(render, forward, redirect)总结
- Zend Framework 重定向方法(render, forward, redirect)总结
- zend framework 重定向方法(render, forward, redirect)总结
- zend framework 重定向方法(render, forward, redirect)总结
- zend framework 重定向方法(render, forward, redirect)总结
- Zend Framework 重定向(render, forward, redirect)
- Zend Framework 跳转方法(render, forward, redirect)区别与总结
- Zend Framework 跳转方法(render, forward, redirect)区别与总结
- Zend Framework 跳转方法(render, forward, redirect)区别与总结 ...
- ZF----重定向:render,forward,redirect,layout
- SpringMVC中使用forward和redirect进行转发和重定向以及重定向时如何传参详解
- forward转发和redirect重定向详解
- java web工程中关于redirect重定向和forward页面转发的区别
- 请求转发(Forward)和重定向(Redirect)的区别
- forward(转发)和redirect(重定向)的区别
- 301 Redirect 资源永久重定向的实现方法
- forward与(重定向)redirect的区别
- Zend framework重定向的方法
- Response.RedirectPermanent() 方法实现301永久性重定向
- iis下设置301 Redirect 永久重定向的方法