Php Cookie:预期时未看到标头
Im使用FireFox的HTTP Live标头查看标头。 我在mydomain.com上写了一个脚本,它只设置了一个测试cookie。 我认为,当我们向一个裸体URL发送请求时,cookies会被发送到所有子域。 但是当我向发送请求时,浏览器没有在头请求中发送cookie。为什么Php Cookie:预期时未看到标头,php,cookies,Php,Cookies,Im使用FireFox的HTTP Live标头查看标头。 我在mydomain.com上写了一个脚本,它只设置了一个测试cookie。 我认为,当我们向一个裸体URL发送请求时,cookies会被发送到所有子域。 但是当我向发送请求时,浏览器没有在头请求中发送cookie。为什么 http://mydomain.com/script.php GET /script.php HTTP/1.1 Host: mydomain.com User-Agent: Mozilla/5.0 (X11; U;
http://mydomain.com/script.php
GET /script.php HTTP/1.1
Host: mydomain.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8pre) Gecko/20100710 Ubuntu/9.10 (karmic) Namoroka/3.6.8pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 16 Jul 2010 00:08:11 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.11
Set-Cookie: UserID=23; expires=Fri, 16-Jul-2010 01:08:11 GMT; path=/
Content-Encoding: gzip
----------------------------------------------------------
http://www.mydomain.com/script.php
GET /script.php HTTP/1.1
Host: www.mydomain.com
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8pre) Gecko/20100710 Ubuntu/9.10 (karmic) Namoroka/3.6.8pre
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 16 Jul 2010 00:08:24 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.11
Set-Cookie: UserID=23; expires=Fri, 16-Jul-2010 01:08:24 GMT; path=/
Content-Encoding: gzip
----------------------------------------------------------
是因为较新的浏览器没有像以前那样发送标题吗?添加域选项,
domain=.mydomain.com
。这与的域参数相对应,如下所述:
“使cookie在所有服务器上都可用
example.com的子域,然后
将其设置为“.example.com”
但是你怎么办s“如果您已经在顶级域example.org而不是www.example.org上设置了cookies,那么对static.example.org的所有请求都将包括这些cookies”-在我的示例中并非如此。