搜索

首页  >  问答  >  正文

检测登陆状态(为什么我在Base.php中写完这个直接报错,我哪写错了嘛?哪个大神帮忙看一下)

protected function _initialize()
    {
        parent::initialize();
        define('USER_ID',Session::get('user_id'));
    }
   
    protected function isLogin()
    {
        if (empty(USER_ID)){
            $this -> error ('用户未登录,无权访问',url('user/login'));
        }
    }
   
    protected function alreadyLogin()
    {
        if (!empty(USER_ID)){
            $this -> error('用户已经登陆,请勿重复登陆',url('index/index'));
        }
    }

ᴬ ᴾᵀᴬ ᴾᵀ2541 天前1252

全部回复(1)我来回复

  • Don't cry

    Don't cry2018-02-27 18:05:40

    你的魔术函数不要给 protected 属性,给public

    回复
    0
  • 取消回复