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和渲染方法

沒有留言:

張貼留言