Rumah > Artikel > pembangunan bahagian belakang > serialize数组,如何写到cookie里面就多了个值呢
serialize数组,怎么写到cookie里面就多了个值呢
$a= array();
$a[]= $id;
var_dump($a);
$content = serialize($a);
var_dump($content);
cookie('uid',$content);
------解决思路----------------------
$a = array(1);<br />$content = serialize($a);<br />setcookie('uid',$content);<br /><br />print_r($_COOKIE);
Array<br />(<br /> [uid] => a:1:{i:0;i:1;}<br />)<br /><br />