检测登陆状态(为什么我在Base.php中写完这个直接报错,我哪写错了嘛?哪个大神帮忙看一下)
ᴬ ᴾᵀ
ᴬ ᴾᵀ 2018-02-27 13:17:34
0
1
1257

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'));
        }
    }

ᴬ ᴾᵀ
ᴬ ᴾᵀ

全部回复(1)
Don't cry

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板