如何从当前 Controller 获取任何 Controller ->id,就像我在默认站点 Controller 中并编写 Yii::$app->controller->id/index
它给了我 site/index
,但是如果我有另一个 Controller ,例如名为 Student(并且我在站点 Controller 中),我如何重定向到 student/index
。
最佳答案
您可以使用重定向
return $this->redirect('/your-controller/your-actionindex',302);
或者干脆不返回
$this->redirect('/user/index',302);
关于controller - Yii2 获取任意 Controller ->Id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38294919/