Home > Backend Development > PHP Tutorial > php 写下和读取序列化的cookie

php 写下和读取序列化的cookie

WBOY
Release: 2016-06-13 11:00:59
Original
862 people have browsed it

php 写入和读取序列化的cookie
  

      public  function saveConfigToCookie(array    $config){         setcookie("c", urlencode(serialize(($config))), time() + 9999999, "/");    }
Copy after login




      public  function loadCookieConfig() {         $configCookieVal = $_COOKIE['c'];         $configArray = unserialize(urldecode($configCookieVal));         return $configArray;    }
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