| 123456789101112131415161718192021222324252627282930313233343536373839404142 | <?phpdeclare (strict_types = 1);/** * +---------------------------------------------------------------------- * | 后台登录控制制器 * +---------------------------------------------------------------------- */namespace app\sys\controller;// 引入框架内置类use think\facade\Session;use think\facade\View;use app\common\model\SysUser;class Login{    // 登录页面    public function index()    {        // 已登录自动跳转        if (Session::has('adminuser')) {            return redirect((string)url('index/index'));        }        $restore_url = Session::has('restore') ? Session::get('restore'): (string)url('index/index');        View::assign('restore_url', $restore_url);        return View::fetch();    }    // 校验登录    public function checkLogin(){        return SysUser::checkLogin();    }    // 退出登录    public function logout(){        Session::delete('adminuser');        return redirect((string) url('login/index'));    }}
 |