hibbsusan
asked on
php session deletion
How come after I run this session and session cookie clearing script (from Murach's php/mysql)
this code, run immediately afterward:
still echos
a : asdf
Thank you!
<?php
session_start( );
session_destroy();
$_SESSION = array();
$name = session_name();
$expire = strtotime('-1 year');
$params = session_get_cookie_params();
$path = $params['path'];
$domain = $params['domain'];
$secure = $params['secure'];
$httponly = $params['httponly'];
setcookie($name, '', $expire, $path, $domain, $secure, $httponly);
?>
this code, run immediately afterward:
foreach ($_SESSION as $key=>$val)
{
echo $key;
echo ' : ';
echo $val;
echo '<br>';
}
still echos
a : asdf
Thank you!
do:
unset($_SESSION['a']);
and then destroy_session();
unset($_SESSION['a']);
and then destroy_session();
err... sorry, session_destroy(); but you already knew that :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Open in new window