PHP知识分享之session && cookie
程序员文章站
2022-05-05 18:27:49
...
'xx', 'age'=>20, 'sex'=>'is_nan', ); session_destroy(); //销毁session if(isset($_SESSION)){ print_r($_SESSION); }else{ echo "session以销毁!"; }/////////////////////////////////////////////////////////////////// // php设置cookie ,php中cookie如何以数组的方式进行存储 $arr = array( 'name'=>'xxxx22', 'sex'=>'boys', 'age'=>21, ); //数组转换字符串存储 $cookie = serialize($arr); //设置cookie setcookie('cookies',$cookie,time()+60*60); print_r($cookies); setcookie('cookies','',time()-3600) //销毁cookie if(isset($cookies)){ print_r($cookies); }else{ echo "cookie已销毁!"; }