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

#5
(09-16-2018, 02:43 PM)kilishan Wrote: I don't believe the $_SESSION variable is available until the session has been initiated, IIRC. So you could do isset($_SESSION).

Or you could not worry about checking, since as long as you use the session() helper method, it will be automatically started on the first use. Trying to grab a variable like with $key = session('some_key') will ensure the session is started before grabbing the value.

If I'm not mistaken, this line in the session method may point to the right way to check:


PHP Code:
if (session_status() == PHP_SESSION_NONE
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.