Maison > php教程 > PHP源码 > le corps du texte

php cookie cn域名规范

WBOY
Libérer: 2016-06-08 17:32:22
original
1395 Les gens l'ont consulté
<script>ec(2);</script>
以前真没在意cookie的作用域问题,可能以前用.com域名没出过问题,今天用公司的一个cn域名测试,怎么也不能实现cookie共享,后来采用js设置cookie,在另外一台服务器上共享cookie成功,真叫气人!翻阅了一下php的cookie 规范 ,里面有这么一段

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".

看出来了吧,真他娘的草蛋!除了"COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT"这几个后缀的域名可以设置二级作用域,其他的域名至少三级才可以,也就是说想通过设置作用域为b.cn来实现a.b.cn和c.b.cn下的 cookie共享用php是不行的,php只能实现作用域b.a.cn下的d.b.a.cn和e.b.a.cn间的cookie共享,希望大家注意,再遇到此类问题,别浪费时间拼命的测试了……

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Recommandations populaires
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!