Home  >  Article  >  Backend Development  >  网站根目录下的程序获取不了子目录生成的cookies?解决思路

网站根目录下的程序获取不了子目录生成的cookies?解决思路

WBOY
WBOYOriginal
2016-06-13 12:10:511006browse

网站根目录下的程序获取不了子目录生成的cookies?
RT,网站根目录下的程序获取不了子目录生成的cookie,子目录可以正常获取,cookie的作用域不是整站的吗  
------解决思路----------------------
在默认的情况下,cookie 的路径是当前路径,即:子目录中生成的 cookie 变量只能在子目录中访问
如果你需要在全站都能访问到,需要给 setcookie 函数的第 4 个参数赋值 /

Statement:
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