A Question Regarding Session Lifetime


I think that my question is actually the same one as in [url=https://forum.infinityfree.com/t/session-persists-after-closing-browser/53539]this topic[/url], but that thread no longer accepts replies and so I had to start a new one.

So, the problem is that previous sessions persist even after entirely closing and subsequently reopening the browser.
To demonstrate this, create 2 scripts. Launch this one before closing your browser:


$_SESSION['test'] = 'The session persists!';[/code]

Next, open this script directly after launching your browser again:


echo $_SESSION['test'];[/code]

If you do so, you will
 see the session persist message.
I know that the session data does not automatically get destroyed when one closes their browser, but what to do if I want to prevent resuming the previous session after reopening the browser?

Many thanks.

The answer in this thread should help you out:


Amazing, thank you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.