Welcome Guest, Not a member yet? Register   Sign In
What is the recommended method of having sessions always on
#2

(This post was last modified: 10-12-2021, 07:09 AM by manager.)

Hi. You can initialize it in a BaseController and other controllers will extend it.
PHP Code:
....
$protected $session;
...

public function 
initController(RequestInterface $requestResponseInterface $responseLoggerInterface $logger)
{
        // Do Not Edit This Line
        parent::initController($request$response$logger);

        $this->session = \Config\Services::session();
        ....
}
... 

Than you can access it like $this->session from ALL controllers extended from Base.
Reply


Messages In This Thread
RE: What is the recommended method of having sessions always on - by manager - 10-12-2021, 07:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB