<?php //1.创建cookie //创建cookie,如下设置,cookie的过期时间为会话结束时 setcookie("name","gaoxiong"); //创建一个包括过期时间的cookie setcookie("age",24,time()+(7*24*60*60)); //设置cookie,获取cookie会慢一拍 //2.读取cookie if (isset($_COOKIE['name'])) { echo $_COOKIE['name']; }; //3.删除cookie setcookie("name",''); setcookie("name","gaoxiong",time()-1); ?>