Welcome Guest, Not a member yet? Register   Sign In
Testing with session
#4

(10-27-2019, 10:31 PM)SteeveDroz Wrote: Just to be clear: I'm not a newbie with basic questions (I actually teach PHP and answer those basic questions all day long).

So first, your code should be:

PHP Code:
if (!isset($_SESSION))
{
    session_start();


Second, according to the PHP manual, session_start() "Start new or resume existing session", which means I wouldn't even need the if as calling that function is idempotent.

Third, thank you for telling me I should use session_start(), but as you may have read in my question, I am in the testing context, within CodeIgniter. I very well know how to start a session, my question is where? In what class? What method? Maybe in a constructor? Or as a protected attribute? Do I change something in .env?

Thank you for reading the question properly before answering.
Ok, point taken, if I am going to use sessions I would put session_start(); near the start of index.php.
Reply


Messages In This Thread
Testing with session - by SteeveDroz - 10-27-2019, 12:05 AM
RE: Testing with session - by John_Betong - 10-27-2019, 08:18 PM
RE: Testing with session - by SteeveDroz - 10-27-2019, 10:31 PM
RE: Testing with session - by John_Betong - 10-28-2019, 01:49 AM
RE: Testing with session - by kilishan - 10-28-2019, 06:34 AM
RE: Testing with session - by SteeveDroz - 10-30-2019, 12:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB