>백엔드 개발 >PHP 튜토리얼 > apache或者php,如何设置页面的cookies

apache或者php,如何设置页面的cookies

WBOY
WBOY원래의
2016-06-13 12:54:461787검색

apache或者php,怎么设置页面的cookies?
curl一个网站,法国天气网。

返回的信息是

Merci d'accepter les cookies<br />
Pour accepter les cookies :<br />
<br />
Sur Internet Explorer : Outils > Options Internet > Confidentialité > Avancé <br />
Sur Firefox: Outils > Options > Vie privée > Cookie > Accepter les cookies <br />
Nous vous informons que vous pouvez vous opposer à l'enregistrement de ces cookies en configurant votre ordinateur selon les modalités détaillées sur le site de la CNIL. (http://www.cnil.fr)<br />
<br />
大致意思是:<br />
<br />
谢谢您接受cookies<br />
要接受Cookie:<br />
<br />
IE浏览器:工具> Internet选项>隐私>高级<br />
在Firefox:工具>选项>隐私>饼干>接受Cookies<br />
我们告诉你,你可能会反对cookie的配置您的计算机的CNIL的网站上详细登记。(http://www.cnil.fr)<br />



CURLOPT_HEADER,true 之后,返回下述信息。

HTTP/1.1 302 Found Date: Thu, 24 Jan 2013 16:09:14 GMT Server: Apache Set-Cookie: jknch=hcnkj; path=/; domain=meteofrance.com Location: http://token.meteofrance.com/?u=%68%74%74%70%3A%2F%2F%66%72%61%6E%63%65%2E%6D%65%74%65%6F%66%72%61%6E%63%65%2E%63%6F%6D%2F%66%72%61%6E%63%65%2F%61%63%74%75%2F%61%63%74%75%3F%70%6F%72%74%6C%65%74%5F%69%64%3D%39%30%31%33%36%26%64%6F%63%75%6D%65%6E%74%5F%69%64%3D%32%37%33%35%34&s=%73%69%6D%2D%70%6F%72%74%61%69%6C&x=%DC%45%F1%A6%56%AD%A9%DE Content-Length: 0 Content-Type: text/html HTTP/1.1 302 Found Date: Thu, 24 Jan 2013 16:09:19 GMT Server: Apache Location: http://france.meteofrance.com/NoCookie.htm Content-Length: 0 Connection: close Content-Type: text/html HTTP/1.1 200 OK Date: Thu, 24 Jan 2013 16:09:20 GMT Server: Apache ETag: "8613ee-89f-4d0d0d2028c80" Accept-Ranges: bytes Xcache: Version 1.2 for Apache 2.2 Last-Modified: Thu, 24 Jan 2013 15:39:23 GMT Content-Length: 2207 Content-Type: text/html


我想请教,这个功能是在apache还是php里设置的?一定要求客户端接受cookies才可以继续浏览?


------解决方案--------------------
本帖最后由 xuzuning 于 2013-01-25 09:51:15 编辑 解释一下返回的头
HTTP/1.1 302 
Found Date: Thu, 24 Jan 2013 16:09:14 GMT 
Server: Apache 
Set-Cookie: jknch=hcnkj; path=/; domain=meteofrance.com 
Location: http://token.meteofrance.com/?u=%68%74%74%70%3A%2F%2F%66%72%61%6E%63%65%2E%6D%65%74%65%6F%66%72%61%6E%63%65%2E%63%6F%6D%2F%66%72%61%6E%63%65%2F%61%63%74%75%2F%61%63%74%75%3F%70%6F%72%74%6C%65%74%5F%69%64%3D%39%30%31%33%36%26%64%6F%63%75%6D%65%6E%74%5F%69%64%3D%32%37%33%35%34&s=%73%69%6D%2D%70%6F%72%74%61%69%6C&x=%DC%45%F1%A6%56%AD%A9%DE 
Content-Length: 0 
Content-Type: text/html 

HTTP/1.1 302 
Found Date: Thu, 24 Jan 2013 16:09:19 GMT 
Server: Apache 
Location: http://france.meteofrance.com/NoCookie.htm 
Content-Length: 0 
Connection: close 
Content-Type: text/html 

HTTP/1.1 200 OK 
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.