CodeIgniter Forums
Native php database sessions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Native php database sessions (/showthread.php?tid=53789)



Native php database sessions - El Forum - 08-09-2012

[eluser]Unknown[/eluser]
Hi. Can anyone tell me how to use native php database sessions in CI (the ones with $_SESSION)? I know that session_set_save_handler needs to be used like this
Code:
$handler = new FileSessionHandler();
session_set_save_handler(
    array($handler, 'open'),
    array($handler, 'close'),
    array($handler, 'read'),
    array($handler, 'write'),
    array($handler, 'destroy'),
    array($handler, 'gc')
    );

Where can I create my own class for handling sessions and how can I use it in controllers and models? Thanks.