diff --git a/application/http/middleware/YanZheng.php b/application/http/middleware/YanZheng.php index 57f0db52..4a30abf2 100644 --- a/application/http/middleware/YanZheng.php +++ b/application/http/middleware/YanZheng.php @@ -13,20 +13,17 @@ class YanZheng extends Controller public function handle($request, \Closure $next) { // 声明帐号密码变量 - $username = 0; - $password = 0; + $username = session('username'); + $password = session('password'); // 如果用户没有登录直接跳转到登录页面 - if( session('?username') ) + if( strlen($username)<1 ) { - $username = session('username'); - $password = session('password'); - }elseif(cookie('username') != null) - { - // 获取用户名和密码 $username = cookie('username'); $password = cookie('password'); - }else{ + } + if( strlen($username)<1 ) + { $this->redirect('/login',302); } diff --git a/application/login/controller/Index.php b/application/login/controller/Index.php index 4ddf352d..281d3fb0 100644 --- a/application/login/controller/Index.php +++ b/application/login/controller/Index.php @@ -102,7 +102,7 @@ class Index extends Controller if($check) { - // Session存值 + session(null); session('userid', $userinfo->id); session('username', $username); session('password', $password); diff --git a/application/rongyu/view/dw_rongyu/create.html b/application/rongyu/view/dw_rongyu/create.html index 965a5c13..1475fdfb 100644 --- a/application/rongyu/view/dw_rongyu/create.html +++ b/application/rongyu/view/dw_rongyu/create.html @@ -248,7 +248,7 @@ } for (var i = data.length - 1; i >= 0; i--) { var myhtml = ""; - myhtml = ""; + myhtml = ""; $('#cySelect').append(myhtml); } diff --git a/config/session.php b/config/session.php index cf88f23a..a4a26306 100644 --- a/config/session.php +++ b/config/session.php @@ -24,5 +24,5 @@ return [ // 是否自动开启 SESSION 'auto_start' => true, // 过期时间 - 'expire' => 1200, + 'expire' => 60, ];