求高手解一段php代码,关于php操作cookie,该怎么解决

WBOY
Release: 2016-06-13 12:02:17
Original
810 people have browsed it

求高手解一段php代码,关于php操作cookie

本帖最后由 a13849178851 于 2014-06-20 17:38:17 编辑
<html><br /><body><br /><?php <br />if(!isset($_COOKIE["build"]))<br />header("location: 1.php");<br />?> <br /></body><br /></html><br />
Copy after login

简化之后就是这个样子的代码,他是能工作的。我的疑惑是:为什么通过php代码能直接读到了位于客户端的cookie值?如果客户端没有js给php返回值的话,php怎么就直接获知了呢?
------解决方案--------------------
浏览器在访问网站时,会将属于该网站的 cookie 自动发出去
------解决方案--------------------
客户端请求的时候会在header中带上cookie值
------解决方案--------------------
header帶有cookies傳到服務器的。
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!