, Execution unset ($_session[' name ') cannot be deleted;
Only if there are multiple sessions, and name is not in the first place can be deleted, in the first session can not be deleted. Is this the case that everyone encountered?
I tried it online and offline, and I couldn't solve it.
The problem was found because I rewrote 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, ' _r EAD '), 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 public 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 (s Elf::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(); // 返回Redis对象$handle = new Session_Redis($cache);
What's wrong with the code?
Reply content:
, Execution unset ($_session[' name ') cannot be deleted;
Only if there are multiple sessions, and name is not in the first place can be deleted, in the first session can not be deleted. Is this the case that everyone encountered?
I tried it online and offline, and I couldn't solve it.
The problem was found because I rewrote 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, ' _r EAD '), 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 public 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 (s Elf::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(); // 返回Redis对象$handle = new Session_Redis($cache);
What's wrong with the code?
Have not encountered, you confirm that the next is not regenerated, you can unset ($_session[' name ") after, give $_session[' name '] re-assign value to try.