public static function shutdown() { foreach ((array) $_SESSION['@ONETIME'] as $token => $remove) { if ($remove) { unset($_SESSION['@ONETIME'][$token]); unset($_SESSION[$token]); } } if (!ini_get('session.use_cookies')) { $tmp = (array) $_SESSION; set_error_handler(function () { }, E_ALL ^ E_NOTICE); session_start(); restore_error_handler(); foreach (array_keys($_SESSION) as $k) { unset($_SESSION[$k]); } foreach (array_keys($tmp) as $k) { $_SESSION[$k] = $tmp[$k]; } } // 记录session_id session_write_close(); if (!ini_get('session.use_cookies')) { // TODO: find a better way to write down session id $idPath = self::_idPath(); File::ensureDir(dirname($idPath), 0775); file_put_contents($idPath, session_id()); } }