gpt4 book ai didi

php - Cookie 在不同页面上不起作用

转载 作者:行者123 更新时间:2023-12-02 22:56:42 26 4
gpt4 key购买 nike

好吧,我设置了一个 cookie,如果我在 Firefox 中访问私有(private)数据,我可以清楚地看到它...好吧,所以当我在某个目录的一页上回显它时,它就可以工作了,(www.example.com/dir),但在网站的索引页(www.example.com)上,它不会回显,它说 cookie 未设置。是的,我启用了cookie,是的,我尝试清除缓存等等。有任何想法吗? PHP 顺便说一句

最佳答案

设置 cookie 时您位于哪个目录?

来自PHP manual on setcookie() ,强调我的:

Path

The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain . If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.

关于php - Cookie 在不同页面上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2038760/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com