Blogger Information
Blog 2
fans 0
comment 0
visits 2007
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php session_start()执行原理
MR大块头先生
Original
1095 people have browsed it

session_start()会做两件事:


1、在客户端生成一个存放PHPSESSID的cookie文件,


这个文件的存放位置和存放方式跟程序的执行方式有关,不同的浏览器也不尽相同,这一步会产生一个序列化后的字符串——PHPSESSID;


2、在服务端生成一个存放session数据的临时文件;


存放的位置由session.save_path参数指定,名称类似于“sess_b2f326ee7a8b7617c215a30d22a602f1”,“sess_”代表这是个session文件,“b2f326ee7a8b7617c215a30d22a602f1”即此次会话的PHPSESSID,跟客户端的PHPSESSID一定是一样的。这个文件里存放的就是$_SESSION变量里的具体值,格式为:


变量名 | 变量类型 : [长度] : 值


eg:test|s:7:"test111";test2|i:22222;


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post