From 13a73823f232155ed21bd0ec720f0233e09b0423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AC=9D=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Wed, 28 Dec 2016 23:10:33 +0800 Subject: [PATCH] Fix session expire problem. --- ThinkPHP/Common/functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ThinkPHP/Common/functions.php b/ThinkPHP/Common/functions.php index b86e686b2..9b1dbe2c9 100644 --- a/ThinkPHP/Common/functions.php +++ b/ThinkPHP/Common/functions.php @@ -1168,7 +1168,10 @@ function session($name='',$value='') { if(isset($name['name'])) session_name($name['name']); if(isset($name['path'])) session_save_path($name['path']); if(isset($name['domain'])) ini_set('session.cookie_domain', $name['domain']); - if(isset($name['expire'])) ini_set('session.gc_maxlifetime', $name['expire']); + if(isset($name['expire'])) { + ini_set('session.gc_maxlifetime', $name['expire']); + ini_set('session.cookie_lifetime', $name['expire']); + } if(isset($name['use_trans_sid'])) ini_set('session.use_trans_sid', $name['use_trans_sid']?1:0); if(isset($name['use_cookies'])) ini_set('session.use_cookies', $name['use_cookies']?1:0); if(isset($name['cache_limiter'])) session_cache_limiter($name['cache_limiter']); @@ -1455,4 +1458,4 @@ function think_filter(&$value){ if(preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|LIKE|NOTLIKE|NOTBETWEEN|NOT BETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i',$value)){ $value .= ' '; } -} \ No newline at end of file +}