Sessions in PHP: completely destroy a session, even without closing the browser

Access the full course ➤

Part of the course “Build a Complete Registration and Login System using PHP MVC”.

When the session_start method is called in a PHP script, PHP stores a session cookie in the browser. By default, this cookie is sent without an expire time, which means it will be deleted when the browser is closed.

However, closing the browser window to destroy a session isn’t always practical, for example if you’re using the session to log in, you wouldn’t really want to ask your users to close the browser to logout.

Learn how to completely destroy a session in PHP in this video.


One comment

Comments are closed.