登陆提交的数据处理方法中添加这些代码
if($data['mdl']) { $_SESSION['name']=$request['uname']; setcookie(session_name(),session_id(),time()+7*24*60*60,'/'); }
在登陆的时候验证
if(!isset($_SESSION['name'])){ session()->flash('danger','你还没登陆'); return redirect("http://localhost/anheng/public/"); }