首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> 網頁程式設計 >> PHP 程式設計 >> PHP 相關知識

Zend Framework 重導向方法總整理

     編輯:PHP 相關知識

Zend Framework 重導向方法總整理

一、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
  • 帶參數:$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('https://localhost/hoge/foo/bar'); → 完整網址
  • $this->_redirect('https://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 程式設計有所幫助。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved