Home > Article > Backend Development > Summary of zend framework redirection methods, zendframework_PHP tutorial
This article summarizes the zend framework redirection methods. Share it with everyone for your reference, the details are as follows:
1. render
Do not specify render
Result: {Current Module}/{Current Controller}/{Current Action}.phtml
$this->render('bar');
Result: {Current Module}/{Current Controller}/bar.phtml
2. forward
$this->_forward('bar');
Result: {current Module}/{current Controller}/bar
$this->_forward('bar', 'foo');
Result: {Current Module}/foo/bar
$this->_forward('bar', 'foo', 'hoge');
Result: hoge/foo/bar
$params = array( 'a' => '1', 'b' => '2' ); $this->_forward('bar', 'foo', 'hoge', $params);
Result: /hoge/foo/bar/a/1/b/2
3. redirect
$this->_redirect('/hoge');
Result: /hoge
$this->_redirect('/hoge/foo');
Result: /hoge/foo
$this->_redirect('/hoge/foo/bar');
Result: /hoge/foo/bar
$this->_redirect('http://localhost/hoge/foo/bar');
Result: http://localhost/hoge/foo/bar
$this->_redirect('http://localhost/hoge/foo/bar?a=1&b=2');
Result: http://localhost/hoge/foo/bar?a=1&b=2
4. Special circumstances
Do not use layout
Result:
$this->_helper->layout()->disableLayout();
Do not use view
Result:
$this->_helper->viewRenderer->setNoRender();
Readers who are interested in more zend-related content can check out the special topics of this site: "Zend FrameWork Framework Introductory Tutorial", "php Excellent Development Framework Summary", "Yii Framework Introduction and Summary of Common Techniques", "ThinkPHP Introductory Tutorial" , "php object-oriented programming introductory tutorial", "php mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will be helpful to everyone’s PHP programming based on the Zend Framework framework.