TP5.0防跳墙访问

<?php
namespace app\index\controller;
use think\Controller;
use think\Session;

class CommenController extends Controller {
    public function _initialize() {
        if (!Session::has('data')) {
            $this->redirect('/');
        }
    }
}

 除login控制器外其他继承CommenController

//系统退出
    public function logout() {
        //  清除think作用域
        Session::clear('think');
        $this->redirect('/');

    }

  

posted @ 2018-05-16 15:13  亦星  阅读(394)  评论(0编辑  收藏  举报