zend framework重定向方法小结,zendframework
本文总结了zend framework重定向的方法。分享给大家供大家参考,具体如下:
一. 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();
更多关于zend相关内容感兴趣的读者可查看本站专题:《Zend FrameWork框架入门教程》、《php优秀开发框架总结》、《Yii框架入门及常用技巧总结》、《ThinkPHP入门教程》、《php面向对象程序设计入门教程》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家基于Zend Framework框架的PHP程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
