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

There's no global object in CI4 like there was in CI3. So if you need to access the session in your model, you need to call the session service again. You can also use the session() helper to minimize the amount of code:
PHP Code:
$this->session session(); 

See https://codeigniter.com/user_guide/libra...-a-session for more details.

For your second question, I don't know why you always get true. All this function do is: 
PHP Code:
return isset($_SESSION[$key]); 
Source: https://github.com/codeigniter4/CodeIgni...n.php#L503
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
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