/** * 生成一个会话文件 * * @param string $sessionID * @return string */ public static function getSessionFile($sessionID) { $fileName = HttpCache::$sessionPath . '/tourze_session_' . $sessionID; Base::getLog()->debug(__METHOD__ . ' get session file', ['file' => $fileName]); if (!FileHelper::exists($fileName)) { Base::getLog()->notice(__METHOD__ . ' session file not found, create it', ['file' => $fileName]); FileHelper::touch($fileName); } return $fileName; }
/** * @inheritdoc */ public function destroy() { // 清空session数据 $_SESSION = []; Base::getLog()->debug(__METHOD__ . ' clean $_SESSION'); // 删除对应的session文件 $sessionID = HttpProtocol::getSessionID(); $file = HttpProtocol::getSessionFile($sessionID); FileHelper::delete($file); Base::getLog()->debug(__METHOD__ . ' delete session file', ['file' => $file]); }