Blogger Information
Blog 30
fans 0
comment 0
visits 23417
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP的session与cookie
深海巨兽皮皮虾的博客
Original
781 people have browsed it

cookie:存储于客户端,记录用户行为 (不用重复登录)

session 存储于服务器,每次用户访问 客户端发送 cookie 中存储的session id 来识别用户

设置cookie

sercookie('name','value',time(),path);//time为过期时间,path为当前目录下访问有效

销毁cookie

setcookie('name',null);
setcookie('name','',time()-1)

读取cookie

$_COOKIE['name'];

Session

session_start();
$_SESSION['name'];
session_unset()//销毁



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