2
如何在更新記錄後將用戶重定向到上一頁?這是典型的場景:yii2更新後返回上一頁
- 用戶在索引頁和搜索結果進行過濾或以上進行分頁的記錄,然後才發現自己想要編輯,然後點擊編輯按鈕之一。他們更新該記錄的數據,一旦他們點擊「更新」按鈕,他們將被重定向到索引視圖,但與之前選擇的過濾器/頁面。在我的控制器使用下面
我用盡更新
return $this->redirect('index',302); (this is not what I need)
return $this->redirect(Yii::$app->request->referrer); (this gets user back to update view and not to index view with filters)
return $this->goBack(); (this gets user to homepage)
謝謝了!
非常感謝! – farrusete