《PHP應用:zend framework重定向方法小結》要點:
本文介紹了PHP應用:zend framework重定向方法小結,希望對您有用。如果有疑問,可以聯系我們。
PHP實例本文總結了zend framework重定向的方法.分享給大家供大家參考,具體如下:
PHP實例一. render
PHP實例不指定render
PHP實例結果: {當前Module}/{當前Controller}/{當前Action}.phtml
PHP實例
$this->render('bar');
PHP實例結果: {當前Module}/{當前Controller}/bar.phtml
PHP實例二. forward
PHP實例
$this->_forward('bar');
PHP實例結果: {當前Module}/{當前Controller}/bar
PHP實例
$this->_forward('bar', 'foo');
PHP實例結果: {當前Module}/foo/bar
PHP實例
$this->_forward('bar', 'foo', 'hoge');
PHP實例結果: hoge/foo/bar
PHP實例
$params = array(
'a' => '1',
'b' => '2'
);
$this->_forward('bar', 'foo', 'hoge', $params);
PHP實例結果: /hoge/foo/bar/a/1/b/2
PHP實例三. redirect
PHP實例
$this->_redirect('/hoge');
PHP實例結果: /hoge
PHP實例
$this->_redirect('/hoge/foo');
PHP實例結果: /hoge/foo
PHP實例
$this->_redirect('/hoge/foo/bar');
PHP實例結果: /hoge/foo/bar
PHP實例
$this->_redirect('http://localhost/hoge/foo/bar');
PHP實例結果: http://localhost/hoge/foo/bar
PHP實例
$this->_redirect('http://localhost/hoge/foo/bar?a=1&b=2');
PHP實例結果: http://localhost/hoge/foo/bar?a=1&b=2
PHP實例四. 特殊情況
PHP實例不使用 layout
PHP實例結果:
PHP實例
$this->_helper->layout()->disableLayout();
PHP實例不使用 view
PHP實例結果:
PHP實例
$this->_helper->viewRenderer->setNoRender();
PHP實例更多關于zend相關內容感興趣的讀者可查看本站專題:《Zend FrameWork框架入門教程》、《php優秀開發框架總結》、《Yii框架入門及常用技巧總結》、《ThinkPHP入門教程》、《php面向對象程序設計入門教程》、《php+mysql數據庫操作入門教程》及《php常見數據庫操作技巧匯總》
PHP實例希望本文所述對大家基于Zend Framework框架的PHP程序設計有所幫助.
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/6305.html