cookies显示有关问题

WBOY
Release: 2016-06-13 11:19:28
Original
794 people have browsed it

cookies显示问题

<br /><?php <br />setcookie("user", "Alex Porter", time()+3600);<br />echo $_COOKIE["user"];<br />?><br />
Copy after login

页面要刷新一下才可以获取值,请问有没办法解决?


------解决方案--------------------
问题是没实际意义,真想要弄可以换成$_SESSION
------解决方案--------------------
楼主要理解cookie发送的原理。
浏览器像服务器发送请求的时候,浏览器会讲存在客户端的cookie信息通过http协议送过去。
服务器拿到这个cookie后,才能echo。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!