From a7e9f62367d71ade9150704bdb73b643b2b45b5f Mon Sep 17 00:00:00 2001 From: liuweiwen <“529520975@qq.com> Date: Fri, 10 Jan 2020 14:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E8=B4=A6=E7=B3=BB=E7=BB=9F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/PublicController.class.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php index c0d0aeb36..673cc9b5a 100644 --- a/Application/Admin/Controller/PublicController.class.php +++ b/Application/Admin/Controller/PublicController.class.php @@ -83,7 +83,6 @@ class PublicController extends \Think\Controller 'mobile_phone' => $mobile, 'level' => 1, ])->find(); - if ($promote) { /* 记录登录SESSION和COOKIES */ $cp_auth = array( @@ -96,8 +95,12 @@ class PublicController extends \Think\Controller ); $session_name = 'cp_user_auth'; if (I('auto_login')) { - session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); - session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); + $expireTime = 60*60*24*30;//自动登录一个月 + ini_set('session.gc_maxlifetime', $expireTime); + ini_set('session.cookie_lifetime', $expireTime); + session($session_name, $cp_auth); + session($session_name.'_sign', data_auth_sign($cp_auth)); + session($session_name.'_expire', time()); } else { session($session_name, $cp_auth); session($session_name.'_sign', data_auth_sign($cp_auth)); @@ -117,8 +120,12 @@ class PublicController extends \Think\Controller ); $session_name = 'cp_user_auth'; if (I('auto_login')) { - session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); - session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); + $expireTime = 60*60*24*30;//自动登录一个月 + ini_set('session.gc_maxlifetime', $expireTime); + ini_set('session.cookie_lifetime', $expireTime); + session($session_name, $cp_auth); + session($session_name.'_sign', data_auth_sign($cp_auth)); + session($session_name.'_expire', time()); } else { session($session_name, $cp_auth); session($session_name.'_sign', data_auth_sign($cp_auth));