Codeigniter - Handle Sessions without cookies

2019-06-07 23:13发布

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?

2条回答
时光不老,我们不散
2楼-- · 2019-06-07 23:21

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

查看更多
时光不老,我们不散
3楼-- · 2019-06-07 23:27

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

查看更多
登录 后发表回答