Home > Backend Development > PHP Tutorial > 50跨站cookie的有关问题

50跨站cookie的有关问题

WBOY
Release: 2016-06-13 13:44:49
Original
779 people have browsed it

50求一个跨站cookie的问题
如果在一个bbs里(bbs.mysite.com),分别设置两个cookie
1.   username=abc   domain=bbs.mysite.com
2.   username=efg   domain=.mysite.com

Q1:下次在读Cookie时,会拿到abc,还是efg?
Q2:我看ie好象是分成两个文件来存cookie的,会不会有其他的浏览器用一个文件来存这样的cookie导致username=abc被efg覆盖?从而只能由其设置的先后次序决定读到的cookie?

------解决方案--------------------
你求不到, cookie不能跨域操作!
------解决方案--------------------
cookie不能跨域

如果你是同一顶级域名下的二级域名用的话

可以设置以下两个
; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain = mysite.com

------解决方案--------------------
传说中有一种系统,session 可以跨域,(不是存在数据库里的那种)
------解决方案--------------------
http://www.baidu.com/s?wd=cookie+%BF%E7%D3%F2&cl=3

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