I didn't really care about the scope of the cookie before, probably used. com domain name has not been a problem, today with a company's CN domain name test, how can not realize cookie sharing, and later use JS set cookies, in another server sharing cookie success, really called irritating! Flipping through the PHP cookie spec, there's a section
Only hosts within the specified domain can set a cookies for a domain and domains must have at least two (2) or three (3) p Eriods in them to prevent domains of the form: ". com", ". edu", and "va.us". Any domain this fails within one of the seven special top level domains listed below only require two. Any of the other domain requires at least three. The seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT".
Look out, you bastard! In addition to "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT" These suffixes of the domain name can be set two scope, the other domain name at least three levels can be, That is to say, you want to implement cookie sharing under a.b.cn and c.b.cn by setting the scope for b.cn. PHP can only implement scope b.a.cn under the d.b.a.cn and e.b.a.cn cookie sharing, I hope you notice that again encounter such problems, do not waste time desperately testing ...