diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php index e68b00824..1b705cc5e 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));