Home  >  Article  >  Backend Development  >  setCookie()的有关问题~

setCookie()的有关问题~

WBOY
WBOYOriginal
2016-06-13 09:58:51841browse

setCookie()的问题~~~~~~~~~~~~~~~~~~~~~~~

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->setCookie('test1', 10, 0);setCookie('test2', 20, 0);var_dump($_COOKIE);


当我运行这个脚本的时候,为什么第一次$_COOKIE是array(0) {},空数组。
必须得刷新一次才能把test1和test2的值刷出来?

------解决方案--------------------
要等下一次浏览器把cookie传过来才能调用
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