Codeigniter - Handle Sessions without cookies

雨燕双飞 提交于 2019-12-08 03:56:52

问题


Some users might not have cookies enabled. Is there a plugin for CI that automatically generates GET-Parameters and parses those parameters (for example in the constructor of a controller)?

What would be a good CI-way of doing this?


回答1:


In CodeIgniter 3 the session library doesn't use cookies. In previous CodeIgniter versions “cookie driver” was the only option and the developers of CI have received negative feedback on not providing that option. Listening to feedback from the community, cookie driver was dropped because it is unsafe.
In CI 3 the Session library comes with 4 drivers, or storage engines, that you can use: files, database, redis, memcached.

www.codeigniter.com/userguide3/libraries/sessions.html#session-drivers




回答2:


Should state, that using params in that way would probably not be a good idea, and I've never heard of a plugin doing that. You'd probably have to deal with routing issues if you did to begin with. However, CI actually gives you a way to store session information in your database. Check out the documentation, it's easy to set up: http://codeigniter.com/user_guide/libraries/sessions.html

This is probably the better way to go, if you don't want to rely on cookies



来源:https://stackoverflow.com/questions/5421403/codeigniter-handle-sessions-without-cookies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!