• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing Session in a custom helper file

I am trying to access the session object in a custom helper file. But an error is thrown when calling


Is there another way to access it?



You'll need to get an instance of the Code Igniter object to do that.

You can make a variable called $CI in your contruct method, like this:
$CI =& get_instance();

Then to get the session you would then replace $this, with $CI, such as:

Hope this helps Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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