CakePHP: Call to a member function setFlash() on a non-object

后端 未结 1 2007
自闭症患者
自闭症患者 2021-02-03 21:41

I get the following error when trying to logout of my CakePHP app:

Notice (8): Undefined property: UsersController::$Session [APP/controllers/users_controller.ph         


        
1条回答
  •  余生分开走
    2021-02-03 22:30

    It looks like you don't have the Session component loaded in your Users controller.

    The Session component should be loaded by default, but if you've set the components array in AppController this will overwrite the defaults.

    This means that if you have

    var $components = array();
    

    in your AppController, make sure the Session component is included there:

    var $components = array('Session');
    

    Alternatively, you can load the Session component in your Users controller if you don't want to use it app-wide.

    0 讨论(0)
提交回复
热议问题