Which PHP Session class should I use? [closed]
I'm looking to do basic stuff with sessions (user logins, authenticated forms & pages) and am just wondering what's the best wrapper/helper class out there to do this.
If you have one that you've written or really like that you'd like to share with some snippets, I'd greatly appreciate it.
If you are doing basic stuff then just directly use $_SESSION
instead of a wrapper over it.
Just use a framework: CodeIgniter, CakePHP, Zend Framework, and many others all have session classes that were written and edited by people smarter than you (or me).
If you don't want to use a framework, a google search brought up this class that does what you wanted.
http://www.daniweb.com/code/snippet216545.html
If using a framework, the CodeIgniter Session Class works very well:
http://codeigniter.com/user_guide/libraries/sessions.html
It also supports "flash" data that only needs to be around for a short period of time.
Sessions can be stored in database form if needed which is considered to be more secure.
Use the built in php session handler, you can specify your own handler if need be.
To implement flash data you could write a simple wrapper class.
精彩评论