• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sessions, how?

#1
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:
Code:
$session = \Config\Services::session($config);

or

$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:
Code:
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:

Code:
$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'?
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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