session_start
时间: 2023-11-02 17:53:35 浏览: 138
Session
session_start()函数用于创建新会话或重用现有会话。如果通过GET或POST方式,或者使用cookie提交了会话ID,则会重用现有会话。\[1\]每次访问backstate_session.php时,SESSION\['fcker'\]都会自增一次。而访问show_session.php时,可以发现查看到的SESSION\['fcker'\]的值与backstate_session.php的显示值一致。\[2\]
session_start()函数的初始化工作包括读取名为PHPSESSID的cookie值,若读取到该cookie,则创建$_SESSION变量,并从相应的目录中读取相应的session文件,将其内容存入$_SESSION变量中。若没有读取到该cookie,则同样创建$_SESSION变量,并创建一个随机命名的session文件,并将该随机命名作为PHPSESSID的cookie值返回给浏览器端。\[3\]
#### 引用[.reference_title]
- *1* *2* [对PHP的session_start()的理解](https://blog.csdn.net/qq_21882325/article/details/76168097)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [php之session_start详解](https://blog.csdn.net/cs23405/article/details/81297698)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文