Why does codeigniter store its sessiondata in a cookie?

前端 未结 4 887
無奈伤痛
無奈伤痛 2020-12-21 10:21

Why does Codeigniter do this? I mean isn\'t it very insecure if users can see which data is stored in their session? And and what if they change a value in the cookie?

4条回答
  •  一生所求
    2020-12-21 10:46

    Well, Codeigniter's out of the box interpretation of sessions is different to that of PHP sessions. You can still use PHP sessions if you want via the $_SESSION super global, but Codeigniter basically treats sessions as more convenient cookies. Although, you can make your sessions store in a database which is what I do and will prevent a user from changing session values.

    If you want semi-secure session variables, use the in-built PHP ones if you don't want the hassle of making Codeigniter store session values in a database encrypted.

    Everything is explained in the detailed documentation: http://codeigniter.com/user_guide/libraries/sessions.html

提交回复
热议问题