简体   繁体   中英

It seems that session was not destroyed precisely in yii2

I tried to destroy my 'session' , but it seems session is accessible Properly after that destruction. even I checked it by 'isActive' and got a response: 'false' but it's still readable and writable yet.

$session=Yii::$app->session;
$session->close();
$session->destroy();
$session->isActive ? $m='ya' : $m='no';
echo $m; // responded 'false'
$_SESSION['test']=1; //session is accessible properly yet
echo $_SESSION['test']; // session response 1

$_SESSION is a PHP global var PHP:SESSION-DOCS

An associative array containing session variables available to the current script. See the Session functions documentation for more information on how this is used.

This means that $_SESSION is always active .. destroy() should "destroy" the actual content of the $_SESSION

http://www.yiiframework.com/doc-2.0/yii-web-session.html

http://www.yiiframework.com/doc-2.0/yii-web-session.html#destroy()-detail

destroy()

In detail Frees all session variables and destroys all data registered to a session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM