, Executing unset ($ _ SESSION [& #039; name & #039;]) cannot be deleted. Only when there are multiple sessions and the name is not in the first place can it be deleted, the first session cannot be deleted. Are you aware of this situation? I have tried both online and offline and cannot solve the problem...
, Unset ($ _ SESSION ['name']) cannot be deleted;
Only sessions with names not in the first place can be deleted. sessions with names not in the first place cannot be deleted. Are you aware of this situation?
I tried both online and offline and cannot solve the problem.
I found the problem because I changed the session_set_save_handler () method:
_ Cache = $ cache; $ this-> _ lifetime = ini_get ('session. gc_maxlifetime '); session_set_save_handler (array ($ this,' _ open'), array ($ this, '_ close'), array ($ this,' _ read '), array ($ this, '_ write'), array ($ this,' _ destroy '), array ($ this,' _ gc '));} // _ open public function _ open ($ savePath, $ name) {return true;} // _ close public function _ close () {$ this-> _ gc ($ this-> _ lifetime); return true;} // _ read pu Blic function _ read ($ id) {$ res = $ this-> _ cache-> get (self: CACHE_KEY. $ id, FALSE); return $ res? $ Res: '';} // _ write public function _ write ($ id, $ value) {if ($ value) {$ flag = $ this-> _ cache-> set (self: CACHE_KEY. $ id, $ value, intval ($ this-> _ lifetime), FALSE); return $ flag;} else {return FALSE ;}} // _ destroy public function _ destroy ($ id) {$ flag = $ this-> _ cache-> delete (self: CACHE_KEY. $ id); return $ flag;} // _ gc public function _ gc ($ lifetime ){}}
Call:
$ Cache = load_cache (); // returns the Redis object $ handle = new Session_Redis ($ cache );
Is there any problem with the code?
Reply content:
, Unset ($ _ SESSION ['name']) cannot be deleted;
Only sessions with names not in the first place can be deleted. sessions with names not in the first place cannot be deleted. Are you aware of this situation?
I tried both online and offline and cannot solve the problem.
I found the problem because I changed the session_set_save_handler () method:
_ Cache = $ cache; $ this-> _ lifetime = ini_get ('session. gc_maxlifetime '); session_set_save_handler (array ($ this,' _ open'), array ($ this, '_ close'), array ($ this,' _ read '), array ($ this, '_ write'), array ($ this,' _ destroy '), array ($ this,' _ gc '));} // _ open public function _ open ($ savePath, $ name) {return true;} // _ close public function _ close () {$ this-> _ gc ($ this-> _ lifetime); return true;} // _ read pu Blic function _ read ($ id) {$ res = $ this-> _ cache-> get (self: CACHE_KEY. $ id, FALSE); return $ res? $ Res: '';} // _ write public function _ write ($ id, $ value) {if ($ value) {$ flag = $ this-> _ cache-> set (self: CACHE_KEY. $ id, $ value, intval ($ this-> _ lifetime), FALSE); return $ flag;} else {return FALSE ;}} // _ destroy public function _ destroy ($ id) {$ flag = $ this-> _ cache-> delete (self: CACHE_KEY. $ id); return $ flag;} // _ gc public function _ gc ($ lifetime ){}}
Call:
$ Cache = load_cache (); // returns the Redis object $ handle = new Session_Redis ($ cache );
Is there any problem with the code?
You have never encountered this problem. Check whether it has been re-generated. You can assign a value to $ _ SESSION ['name'] After unset ($ _ SESSION ['name.