where('id',$userId)->find(); if($user){ //验证cookie $salt = 'taoler'; $auth = md5($user['name'].$salt).":".$userId; if($auth==$cooAuth){ Session::set('user_name',$user['name']); Session::set('user_id',$userId); } } } return $next($request); } }