Caching variables in the $_SESSION variable?

后端 未结 3 1736
暗喜
暗喜 2021-02-14 16:09

I\'m making a php web application which stores user specific information that is not shared with other users.

Would it be a good idea to store some of this information i

3条回答
  •  情话喂你
    2021-02-14 16:30

    If you only want this data available during their session, then yes. If you want it available tomorrow, or 4 hours from now, you need to save it to a database.

    Technically you can modify the sessions to have a very long lifespan, but realize if they use a different computer, a different browser or flush their cookies they will loose the link to their session, therefore anything serious you should create a type of user account in your application, link the session to their account and save the data in a permeate place.

提交回复
热议问题