search

Home  >  Q&A  >  body text

Check the login status (why did I report an error immediately after writing this in Base.php? Where did I write it wrong? Can anyone help me look at it?)

protected function _initialize()
{
parent::initialize();
define('USER_ID',Session::get('user_id'));
}

protected function isLogin()
{
if (empty(USER_ID)){
$this -> error ('The user is not logged in and has no permission to access',url('user/login') ; Log in, please do not log in again',url('index/index'));

ᴬ ᴾᵀᴬ ᴾᵀ2464 days ago1224

reply all(1)I'll reply

  • Don't cry

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

    Don’t give protected attributes to your magic functions, give them public

    reply
    0
  • Cancelreply