1
//1st page
session_start();
$_SESSION['a']=1;
//2nd page
session_start();
echo $_SESSION['a'];

I couldn't destroy session when chrome close the browser, i have tried add

session_set_cookie_params(0); or session_cache_expire(1);

those are not working, I read lots post, just cant find the solution.

Ben
  • 2,562
  • 8
  • 37
  • 62

1 Answers1

1

try creating a new page to destroy ur session

//1st page
session_start();
$_SESSION['a']=1;
<a href="end.php"> End Session</a>

//2nd page(end.php)
session_start();
session_destroy();
Mystro
  • 100
  • 10
  • what im asking is when browser close, it auto destroy session – Ben Sep 06 '13 at 02:05
  • it wont destroy instantly but rather after the default time is due (http://stackoverflow.com/questions/4233924/what-is-the-default-session-expiration-time-in-php) the would it destroy – Mystro Sep 06 '13 at 02:13