时间:2021-07-01 10:21:17 帮助过:21人阅读
$cart_info[0][0] = "1123"; $cart_info[1][0] = "5334521"; $cart_info[1][2] = "df"; $cart_info[4][2] = "fefe"; setcookie("xia",serialize($cart_info)); ?>
b.php
$other = StripSlashes($_COOKIE['xia']); print_r(unserialize($other)); ?>
// js 创建cookie
// var name = "str1"; var function SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值 { var Days =30; //此 cookie 将被保存 30 天 varexp = newDate(); //newDate("December 31, 9998"); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" +exp.toGMTString(); } functiongetCookie(name)//取cookies函数 { var arr =document.cookie.match(new RegExp("(^|)"+name+"=([^;]*)(;|$)")); if(arr != null) return (arr[2]); return null; } function delCookie(name)//删除cookie { var exp =new Date(); exp.setTime(exp.getTime() - 1); varcval=getCookie(name); if(cval!=null) document.cookie= name +"="+cval+";expires="+exp.toGMTString(); } SetCookie ("xiaoqi", "3")