Phpcookiecn domain name specification-PHP source code

Source: Internet
Author: User
Tags top level domains
Ec (2); in the past, I did not really care about the cookie scope. It may have been used before. there was no problem with the com domain name. I tested it with a company's cn Domain Name today, so I could not share cookies. Later I used js to set cookies and shared them on another server, really irritating! I read the php cookie specification, which contains the Onlyhostswithinthespecifieddomaincanset script ec (2); script

I did not really care about the cookie scope in the past. It may have been used before. there was no problem with the com domain name. I tested it with a company's cn Domain Name today, so I could not share cookies. Later I used js to set cookies and shared them on another server, really irritating! I read the php cookie specification, which contains such a section.

Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form :". com ",". edu ", and" va. us ". any domain that fails within one of the seven special top level domains listed below only require two periods. any other domain requires at least three. the seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT ".

Let's see it. It's a pretty cool! In addition to the "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT" suffixes, domain names can be configured with secondary scopes, other domain names must be at least three levels. That is to say, you cannot use php to share cookies under a. B .cn and c. B .cn by setting the scope to B .cn, php can only implement cookie sharing between d. B .a.cn and e. B .a.cn under the scope B .a.cn. I hope you will pay attention to this problem and avoid wasting your time to test it ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.