2016-08-31 82 views

回答

1

試試這個

Yii::$app->getResponse()->redirect(['home','id' => $id])->send(); 
+0

您無法通過重定向傳遞post參數,您可以通過JavaScript構建和提交表單。 – Fisher

+0

或者您可以在會話中保存參數並在新頁面中讀取 – Fisher

0

爲了完整的控制器上下文起見,你可以使用:

class MyController extends \yii\web\Controller 
{ 
    public function actionIndex() 
    { 
     return $this->redirect(['home', 'id' => 123]); 
    } 
} 

redirect()數組參數等於yii\helpers\Url::to()

相關問題