Код: Выделить всё
$this->goBack();
Как например сделать кнопку назад если/**
* Redirects the browser to the last visited page.
*
Код: Выделить всё
\Yii::$app->user->getReturnUrl();
Код: Выделить всё
$this->goBack();
Как например сделать кнопку назад если/**
* Redirects the browser to the last visited page.
*
Код: Выделить всё
\Yii::$app->user->getReturnUrl();
Код: Выделить всё
public function afterAction($action, $result)
{
Yii::$app->getUser()->setReturnUrl(Yii::$app->request->url);
return parent::afterAction($action, $result);
}
Нужно запоминать урл-возврата самостоятельно. Рефирер нельзя юзать по многим причинам, одна из них - подмена заголовка.@param string|array $defaultUrl the default return URL in case it was not set previously.
If this is null and the return URL was not set previously, [[Application::homeUrl]] will be redirected to.
Please refer to [[User::setReturnUrl()]] on accepted format of the URL.
Код: Выделить всё
Yii::$app->getUser()->setReturnUrl($this->request->getUrl())
Код: Выделить всё
$this->redirect(Yii::$app->request->referrer)