Welcome Guest, Not a member yet? Register   Sign In
Sessions, how?
#2

(This post was last modified: 09-08-2020, 09:01 AM by captain-sensible.)

yes i struggle with the docs sometimes; what i do is get concepts working anyway i can then re-visit docs for more elegant ways of doing it.

This is the start of one of my controller's :
Code:
public function credentials()

{
    session_start();
        
    $theArray= $_SESSION['captcha'];

first line of controller (and also any controller) that will pick up the ball will have as first line
session_start();

I set a session array variable using $_SESSION


then later

Code:
public function logout()
              {
               session_start();
                unset($_SESSION['role']);
                unset($_SESSION['count']);
// first line is still session_start();

this is part of a method to unset sessions I use

this is basically old school php ; i'm using it on codeigniter4.0.4


mind you, when i say old school, $_SESSION is not that old since if you look inside SESSION.php file

mine is at vendor/codeigniter4/framework/system/Session/Session.php there are a lot of references and use of $_SESSION
Reply


Messages In This Thread
Sessions, how? - by blaasvaer - 09-08-2020, 05:02 AM
RE: Sessions, how? - by captain-sensible - 09-08-2020, 08:50 AM
RE: Sessions, how? - by stlake2011 - 09-08-2020, 04:04 PM
RE: Sessions, how? - by InsiteFX - 09-09-2020, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB