PHP $_SESSION Implementation

后端 未结 6 824
情话喂你
情话喂你 2021-01-23 07:25

Does anyone know how PHP maps session IDs to $_SESSION arrays? In other words, given session ID x, where does PHP pull the values from to populate the $_SESSION array?

6条回答
  •  闹比i
    闹比i (楼主)
    2021-01-23 08:01

    With the default implementation of sessions (which can be replaced by a custom one if needed) the data is stored in local files. Your server receives the session ID from the client in a cookie, finds the corresponding local file on your server and populates data into $_SESSION.

    Gaining access to this data requires file-level access on the server, which is not impossible, unless your server is secure enough.

提交回复
热议问题