<?php namespace app\middleware; use think\facade\Session; use think\facade\Cookie; class LoginCookie { public function handle($request, \Closure $next) { //登陆前Cookie检测 if(Cookie::get('user_id')){ //dump(Cookie::get('user_id')); Session::set('user_id',Cookie::get('user_id')); Session::set('user_name',Cookie::get('user_name')); } return $next($request); } }