开发者

Which PHP Session class should I use? [closed]

开发者 https://www.devze.com 2023-01-06 11:13 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_JAVA技巧 Closed 10 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号