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

Summary of zend framework redirection methods, zendframework_PHP tutorial

WBOY
Release: 2016-07-12 08:50:54
Original
722 people have browsed it

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');

Copy after login

Result: {Current Module}/{Current Controller}/bar.phtml

2. forward

$this->_forward('bar');

Copy after login

Result: {current Module}/{current Controller}/bar

$this->_forward('bar', 'foo');

Copy after login

Result: {Current Module}/foo/bar

$this->_forward('bar', 'foo', 'hoge');

Copy after login

Result: hoge/foo/bar

$params = array(
 'a' => '1',
 'b' => '2'
);
$this->_forward('bar', 'foo', 'hoge', $params);

Copy after login

Result: /hoge/foo/bar/a/1/b/2

3. redirect

$this->_redirect('/hoge');

Copy after login

Result: /hoge

$this->_redirect('/hoge/foo');

Copy after login

Result: /hoge/foo

$this->_redirect('/hoge/foo/bar');

Copy after login

Result: /hoge/foo/bar

$this->_redirect('http://localhost/hoge/foo/bar');

Copy after login

Result: http://localhost/hoge/foo/bar

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

Copy after login

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

4. Special circumstances

Do not use layout

Result:

$this->_helper->layout()->disableLayout();
Copy after login

Do not use view

Result:

$this->_helper->viewRenderer->setNoRender();
Copy after login

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template