Home  >  Article  >  Backend Development  >  Summary of zend framework redirection methods, zendframework_PHP tutorial

Summary of zend framework redirection methods, zendframework_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:50:54692browse

A summary of zend framework redirection methods, zendframework

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133059.htmlTechArticleSummary of zend framework redirection methods, zendframework This article summarizes the zend framework redirection methods. Share it with everyone for your reference, the details are as follows: 1. render does not specify the render result...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn