Home  >  Article  >  Backend Development  >  A small example of php multi-value cookies

A small example of php multi-value cookies

WBOY
WBOYOriginal
2016-07-25 08:56:20819browse
  1. /**
  2. * Set php multi-value cookies
  3. * by bbs.it-home.org
  4. */
  5. if (!isset ($userdetails [0] ) ) {
  6. setcookie ("userdetails[0]", $username);
  7. }
  8. $ userdetails[1]++;
  9. setcookie ("userdetails[1]", $userdetails[1]);
  10. echo ("Hello $userdetails[0], you have visited this page: ".$userdetails[1]. ($userdetails[1] == l?" time!": "times!"));
  11. ?>
Copy code


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