【发布时间】:2011-01-28 16:47:21
【问题描述】:
情况:
- 我正在尝试在一个域 secure.example.com 下运行 https 商店 (xcart),并且我想访问它在 http www.example.com 中设置的 cookie
- 我在 Apache (MAMP) 上运行 PHP,在 Firefox 中使用 Firecookie 进行测试
- 现有代码将 cookie 设置为
.secure.example.com。我不确定这是否与 xcart 相关,但setcookie实际上是使用secure.example.com调用的。我不确定为什么要附加“.”。
问题:
-
当我尝试在 https 中使用
setcookie以使用域.example.com或仅使用example.com时,无论我是在 http 还是 https 下运行商店,都不会创建任何 cookie。我正在使用的测试代码是:setcookie('three', 'two', 0, "/", ".example.com");
如果我将 cookie 设置为 secure.example.com 或 .secure.example.com,它会显示出来。
cookie 没有显示是否有原因?
【问题讨论】:
-
Gumbo - 看起来 nilacqua 在使用 localhost 时调用 setcookie 时正在使用 .example。