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

(This post was last modified: 09-08-2020, 05:03 AM by blaasvaer.)

I seem to constantly having a hard time reading and actually USING the docs:

Can someone tell med HOW, WHERE and WHEN to use this:
$session = \Config\Services::session($config);


$session = \Config\Services::session(); // Without the $config

It's the first line of 'code' in the docs about the Session Library (https://codeigniter4.github.io/userguide...ht=session) ... but I cannot – from the docs – figure out HOW to implement and USE it.

If I put it into a Controller, I get this:
syntax error, unexpected '$session' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST)

Can somone explain why I'm getting this, and what it is that I seem to be constantly missing when 'reading' the docs?

I see this a LOT in the docs '$variable = something … ', but WHENEVER I try to implement what I'm reading in the docs I ALWAYS get errors.

Now, does:

$variable = ...

in the docs have some 'magical' meaning (should it be 'read' in some particular way)? Or is it simply because the docs 'assume' YOU know where you're supposed to 'put' this code ... and therefore leaving out the (not so) 'obvious'?

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