Remove remember Url

Hallo everybody,

with Url::remember() i can save the actual url to call it on a other site with Url::previous().

Is there any way to delete the remember Url after i called the url once?

Thanks…

Looking at the method itself, it seems like passing null should do it in case it is not named (i.e second param is not defined

see: https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseUrl.php#L298

Yii::$app->getSession()->remove(Yii::$app->getUser()->returnUrlParam); should do the trick.

1 Like

The un-named link seems not to set anything in session!

This variant works. Thanks a lot.

I called the function without parameters. But that didn’t change anything…

Put the code on how you did it, in both remembering and removing.
It seems there is a different issue here, if your code is indeed correct!