0

I need to destroy session after page closed in browser. i tried to unset $_session['value']; but it can not working it destroy current page but i need destroy after closed in browser

  • does this help? http://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes – atoms Jul 06 '16 at 10:47
  • no it does not work for me i need destroy session after page closed in browser not some minutes.. –  Jul 06 '16 at 10:50
  • 1
    You could listen to the event `unload` and asynchronously call a php page which then destroys the session. But I think every professional php/js-developer will hate me for that idea... –  Jul 06 '16 at 10:53

1 Answers1

-1

You can write this

session_set_cookie_params(0);
session_start();

This will destroy session when the browser is closed.

Jahid Mahmud
  • 1,136
  • 1
  • 12
  • 32