本人原本是用編輯器以OOP來寫PHP, 但因為有大大說別再刻輪子了, 所以下定決心要好好學個MVC架構的框架, 讓自己的程式結構分明、易維護. 最後經過多方比較後決定學Yii framework, 學習的過程中, 深刻感受到國內關於這個框架的資源, 相較國外及大陸之下明顯不足, 所以希望自己能為台灣的開發者盡一份力. 我是Joker 一位自學者, 一起來大玩特玩吧!
2014年12月25日 星期四
yii redirect轉址說明
跳到絕對路徑:
$this->redirect('http://code-joker.blogspot.tw/');
跳到本身Controller的某個action:
$this->redirect(array('index');
在module(模組)裡要跳到預設的Controller裡(protected/controllers/):
$this->redirect(array('/user/index');
在module(模組)裡要跳到本身模組的其他Controller:
$this->redirect(array('other/index');
在module(模組)裡要跳到其他模組的其他Controller:
$this->redirect(array('/ortherModule/otherController/index');
PS:常用到的URL請取得方式參考下面連結
參考:
YII路由跳转forward\redirect
Yii的常用URL和渲染方法
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言