Hello there,

How to destroy session data when the browser closes ?
Note, not dealing with $_COOKIES here.

Thanks!

The server has no concept of when the web browser is closed. However, PHP sessions are typically tracked with cookies, and you can set those cookies to expire when the browser window is closed. I believe PHP has its own session garbage collector that automatically deletes the files associated with old, expired sessions (based on the session.gc_maxlifetime setting).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.