Welcome Guest, Not a member yet? Register   Sign In
Difficulties with autoload session

(This post was last modified: 07-17-2021, 04:59 PM by Iosef.)

In my base controller under the line parent::initController($request, $response, $logger); I added this other:

$session = \Config\Services:Confusedession($config)

However Im trying to use flash data in my login controller and Im getting the following error:
Call to a member function setFlashdata() on null

It looks that what I did was not enough to have session autoloaded in every controller. What am I missing?

You can also use the session helper method.
PHP Code:

PHP Code:
    if (session_status() == PHP_SESSION_NONE)
    $this->session Services::session();

Try that.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

(This post was last modified: 07-18-2021, 02:37 AM by Iosef.)

[quote pid="388644" dateline="1626581238"]
Thank you, was actually a silly mistake, I started the session in the default controller as $session; instead of $this->session;

Theme © iAndrew 2016 - Forum software by © MyBB