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

setCookie()的有关问题~

WBOY
Release: 2016-06-13 09:58:51
Original
860 people have browsed it

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);
Copy after login


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

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