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程序设计有所帮助。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

Dreamweaver CS6
视觉化网页开发工具

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

禅工作室 13.0.1
功能强大的PHP集成开发环境

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境