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

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

WBOY
Release: 2016-06-13 12:21:14
Original
1166 people have browsed it

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);
Copy after login
Array<br />(<br />    [uid] => a:1:{i:0;i:1;}<br />)<br /><br />
Copy after login


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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template