Beispiel #1
0
 /**
  * 清除SESSION
  *
  * @param string $sid 会话唯一标识
  * @return boolean 清除成功返回true否则为false
  */
 public function destroy($sid = '')
 {
     if (empty($sid)) {
         $sid = $this->get_id();
     }
     /**
      * 以数据库方式来处理SESSION
      */
     if ($this->_type == 'db' || $this->_type == 'mdb') {
         $this->_db->query("DELETE FROM {$this->_opt} WHERE sId = '{$sid}'");
         return $this->_db->affected_rows() > 0 ? true : false;
     }
     /**
      * 以Memcache缓冲方式来处理SESSION
      */
     if ($this->_type == 'mem') {
         return $this->_mem->del('session', $sid);
     }
     /**
      * 以文件系统的方式来处理SESSION
      */
     if ($this->_type == 'dir') {
         $sfile = "{$this->_path}/{$sid[0]}/{$this->_prefix}-{$sid}";
     } else {
         $sfile = "{$this->_path}/{$this->_prefix}-{$sid}";
     }
     return !empty($sfile) ? @unlink($sfile) : true;
 }
Beispiel #2
0
 /**
  * 删除数据
  *
  * @param string $mkey 获取码(mem key)
  * @return boolean 存储成功返回true反知为false
  */
 public function mem_del($mkey)
 {
     return $this->mem->del($this->mem_type_res, $mkey);
 }