TaoLer/app/middleware/LoginCheck.php
2020-01-01 13:17:19 +08:00

18 lines
281 B
PHP

<?php
namespace app\middleware;
use think\facade\Session;
class LoginCheck
{
public function handle($request, \Closure $next)
{
//需要登陆的操作
if(Session::has('user_id')){
return $next($request);
} else {
return redirect('/login/index');
}
}
}