PHP + 即6 + cookie:cookie 的 hello world 失败

发布于 2024-07-24 06:34:45 字数 1024 浏览 4 评论 0原文

我尝试过,没有成功! 我的问题是 php 的 setcookie() 在 IE6 中失败。它在 Firefox 3 和 IE7/8 上功能齐全(尽管有错误)。 以下是代码。 IE6显示失败。 简单的问题:为什么?

<?
    header('P3P: CP="DEV PSAi NAV STP DEM OTRo NOI IDC 
                     DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); 

    setcookie('hello', 'poopoo');

    echo $_COOKIE['hello'];
?>

我怀疑 P3P链接) ,或者可能是时区的一些错误 - IE6 javascript 没有将时间转换为 php 使用的相同标准(这样所有服务器发出的 cookie 都会自动过期)。

这是我所做的: 对于p3p问题,我插入了上面的标题标签。 我还创建了一个策略文件和一个策略参考,并通过 w3c 的 p3p 检查器运行我的网站,没有出现任何错误。

对于时区问题,我在 browscap.ini 中重置了时区。 我还将时钟向前和向后调整了 24 小时。

如果您能给我任何新的尝试,我将非常感激。 我所需要的只是 IE6 的 Hello World cookie 设置器。

我很感激。

*更新:我听说独立版 IE6 存在与此相匹配的问题。 使用 IE6 的任何人都可以快速检查一下您是否可以将商品添加到我的 alpha 上的购物车?

I tried, to no avail! My problem is php's setcookie() fails in IE6. It's fully functioning (albeit buggy) for Firefox 3 and IE7/8. The following is the code. IE6 displays fail. Simple question: why?

<?
    header('P3P: CP="DEV PSAi NAV STP DEM OTRo NOI IDC 
                     DSP COR CURa ADMa OUR IND PHY ONL COM STA"'); 

    setcookie('hello', 'poopoo');

    echo $_COOKIE['hello'];
?>

I suspected P3P (link), or maybe some bug with the timezone-- IE6 javascript not converting time to the same standard that php uses (so that all server-issued cookies are automatically expired).

Here's what I've done:
For the p3p issue, I inserted the above header tag. I've also created a policy file, and a policy reference, and run the my site through w3c's p3p checker with no errors.

For the timezone issues, I reset the time zone in browscap.ini. I also tweaked my clock forward, and backward by 24 hours.

If you can give me any new things to try, it would be very much appreciated. All I need is a Hello World cookie setter for IE6.

I appreciate it.

*Update: I caught wind that the standalone IE6 has issues that match this. Can anyone with IE6 do a quick check that you can add items to the cart on my alpha?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

野味少女 2024-07-31 06:34:45

最终更新:在 vista 上运行独立 ie6 引起的错误。 Dl'ed 官方 msft 虚拟电脑和虚拟高清,该网站运行完美。

Final Update: Bug caused by standalone ie6 run on vista. Dl'ed official msft virtual pc and virtual hd and the site worked perfect.

不及他 2024-07-31 06:34:45

IE 的安全设置是什么?

难道是它的安全设置不允许你为其写入cookie?

What are the security settings for IE?

Could it be that the security settings on it don't allow you to write cookies for it?

走过海棠暮 2024-07-31 06:34:45

$_COOKIE 数组在脚本初始化期间被填充。 它不会被 setcookie 更改:该值将在下一页加载时更改。

请参阅 setcookie 函数的 php 手册:

设置 cookie 后,可以在下一个页面加载时使用 $_COOKIE 或 $HTTP_COOKIE_VARS 数组访问它们。

The $_COOKIE array is filled during your script initialisation. It is not changed by setcookie : the value will have changed at next page loading.

See the php manual for the setcookie function :

Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文