framework/helpers/BaseUrl.php
public static function remember($url = '', $name = null)
    {
        $url = static::to($url);

        if ($name === null) {
            Yii::$app->getUser()->setReturnUrl($url);
        } else {
            Yii::$app->getSession()->set($name, $url);
        }
    }
public static function remember($url = '', $name = null)
    {
        $url = static::to($url);

        if ($name === null) {
            Yii::$app->getUser()->setReturnUrl($url);
        } else {
            Yii::$app->getSession()->set($name, $url);
        }
    }
Remembers the specified URL so that it can be later fetched back by [[previous()]].

@param string|array $url the URL to remember. Please refer to [[to()]] for acceptable formats.
If this parameter is not specified, the currently requested URL will be used.
@param string $name the name associated with the URL to be remembered. This can be used
later by [[previous()]]. If not set, [[\yii\web\User::setReturnUrl()]] will be used with passed URL.
@see previous()
@see \yii\web\User::setReturnUrl()