Home  >  Article  >  Backend Development  >  serialize数组,如何写到cookie里面就多了个值呢

serialize数组,如何写到cookie里面就多了个值呢

WBOY
WBOYOriginal
2016-06-13 12:21:141154browse

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 />


你用了自己饿得函数,那就从自己的函数上找原因

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn