How to achieve redirection in zend framework
Editor to share with you how to achieve zend framework redirection, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The details are as follows:
one。 Render
Do not specify render
Result: {current Module} / {current Controller} / {current Action} .phtml
$this- > render ('bar')
Result: {current Module} / {current Controller} / bar.phtml
two。 Forward
$this- > _ forward ('bar')
Result: {current Module} / {current Controller} / bar
$this- > _ forward ('bar',' foo')
Result: {current Module} / foo/bar
$this- > _ forward ('bar',' foo', 'hoge')
Results: hoge/foo/bar
$params = array ('a'= > '1century,' b' = >'2'); $this- > _ forward ('bar',' foo', 'hoge', $params)
Result: / hoge/foo/bar/a/1/b/2
three。 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');
Results: http://localhost/hoge/foo/bar
$this- > _ redirect ('http://localhost/hoge/foo/bar?a=1&b=2');
Results: http://localhost/hoge/foo/bar?a=1&b=2
four。 Special circumstances
Do not use layout
Results:
$this- > _ helper- > layout ()-> disableLayout ()
Do not use view
Results:
$this- > _ helper- > viewRenderer- > setNoRender (); that's all of the article "how to redirect zend framework". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!