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

3
  • does this help? stackoverflow.com/questions/520237/…
    – atoms
    Jul 6, 2016 at 10:47
  • no it does not work for me i need destroy session after page closed in browser not some minutes..
    – user6303241
    Jul 6, 2016 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...
    – user5653854
    Jul 6, 2016 at 10:53

1 Answer 1

-1

You can write this

session_set_cookie_params(0);
session_start();

This will destroy session when the browser is closed.

3
  • Is this work on page close in browser?
    – user6303241
    Jul 6, 2016 at 11:01
  • No this will destroy session when the browse is closed. Jul 6, 2016 at 11:13
  • May be you can find the answer here stackoverflow.com/questions/3177364/…. hopefully this might help you Jul 6, 2016 at 11:13