From 0117543df0241fb57cbd56301ce63abcaa4ea1b4 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 20 Oct 2016 10:59:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BSession=E7=B1=BB=E7=9A=84flus?= =?UTF-8?q?h=E6=96=B9=E6=B3=95=20=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=BC=80=E5=90=AFsession?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Session.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/library/think/Session.php b/library/think/Session.php index 822f0453..626c8c11 100644 --- a/library/think/Session.php +++ b/library/think/Session.php @@ -217,14 +217,16 @@ class Session */ public static function flush() { - $item = self::get('__flash__'); + if (self::$init) { + $item = self::get('__flash__'); - if (!empty($item)) { - $time = $item['__time__']; - if ($_SERVER['REQUEST_TIME_FLOAT'] > $time) { - unset($item['__time__']); - self::delete($item); - self::set('__flash__', []); + if (!empty($item)) { + $time = $item['__time__']; + if ($_SERVER['REQUEST_TIME_FLOAT'] > $time) { + unset($item['__time__']); + self::delete($item); + self::set('__flash__', []); + } } } }