• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to tell if session loaded?

#1
Sorry if this seems like a stupid question, but I'm not actually playing with CI4, so I can't dig through code, debug, and figure things out on my own.

From the docs:


Quote:Sessions will typically run globally with each page load, so the Session class should be magically initialized.



The part that I'm concerned with is "should be". If the session is already initialized, would calling session() a second time mess things up?

PHP Code:
$session = \Config\Services::session(); 

In CI3 I could do this: 

PHP Code:
if( ! $this->load->is_loaded('session') )
    
$this->load->library('session'); 

But in CI4, since session() takes a config param, do I worry about calling session() a second time and creating a conflict? How would I know that $session is initialized?
Reply


Messages In This Thread
How to tell if session loaded? - by skunkbad - 09-15-2018, 10:36 AM
RE: How to tell if session loaded? - by kilishan - 09-16-2018, 11:44 AM
RE: How to tell if session loaded? - by skunkbad - 09-16-2018, 01:50 PM
RE: How to tell if session loaded? - by kilishan - 09-16-2018, 02:43 PM
RE: How to tell if session loaded? - by skunkbad - 09-16-2018, 10:09 PM
RE: How to tell if session loaded? - by InsiteFX - 09-17-2018, 04:02 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.