What are sessions and cookies in php and where are they stored?

后端 未结 4 742
鱼传尺愫
鱼传尺愫 2020-12-21 12:16

What are sessions and cookies in php and where are they stored?

I searched but I can\'t find the exact answer.

4条回答
  •  青春惊慌失措
    2020-12-21 12:52

    A cookie is some piece of data the server requests the client to store and send in consequent requests.

    A session is some data stored on the server, and connected to the user via a session id. This session id is most of the time stored in a cookie.

    A session can be stored on the filesystem, most likely in a temp directory, but also in a database.

    Both cookies and sessions have a expiration date connected to them, so they wont last forever.

提交回复
热议问题