Welcome Guest, Not a member yet? Register   Sign In
Issue with Session
#1

Hi everyone,

I'm new with CI (4.1.9) and my first steps went well.

But now I'm facing some issue with the session helper.

1.)
I added the following code in my BaseControllers InitController method.
PHP Code:
$this->session = \Config\Services::session(); 

When I use it with $this->session->get() in my controller everything works fine. But I get a
Code:
Call to a member function get() on null

as soon as I use it in one of my models.
How can I use the session service within my models?

2.) In case I check the existence of a session variable I get always a true, even if the variable is not existing.
PHP Code:
$this->session->has('test'); 
Now I'm checking, if this session is null.
Why is the return value of the code above always true?

Thanks in advance.

Could someone support me?
Reply


Messages In This Thread
Issue with Session - by Blasse133 - 04-27-2022, 09:03 AM
RE: Issue with Session - by includebeer - 04-30-2022, 04:19 AM
RE: Issue with Session - by Blasse133 - 05-09-2022, 06:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB