IE7中的Cookie [英] Cookie in IE7
问题描述
我有一个可以持续30天的cookie。如果我放一行< img
src =" http://www.example.com/readcookie.php"宽度= QUOT 1 QUOT;
php文件中的height =" 1"如果我使用IE7,我无法读取cookie。但是,它适用于
Firefox和Chrome。如果我尝试访问网址 http://www.example.com/readcookie.php
IE7中的
,我能够读取cookie。
我使用以下代码行
设置cookie
setcookie(" TestCookie",$ userid,time()+(60 * 60 * 24 * 30)," /" ); -------------
I have st a cookie that would last for 30 days. If I put a line <img
src="http://www.example.com/readcookie.php" width="1" height="1"in a
php file, I cannot read the cookie if I use IE7. However, it works in
Firefox and Chrome. If I try to access the URL http://www.example.com/readcookie.php
in IE7, I am able to read the cookie then.
I am using the following lines of code
to set the cookie
setcookie("TestCookie",$userid,time()+(60*60*24*30 ),"/"); -------------
设置cookie
Sets the cookie
读取饼干
$ MyUserId = $ _COOKIE [''TestCookie'']; -------------------------如果我尝试访问包含此代码的文件,则设置
变量$ MyUserId
。但是,如果我包含包含此代码的文件
,则此代码不起作用。
to read the cookie
$MyUserId = $_COOKIE[''TestCookie'']; -------------------------Sets
the variable $MyUserId if I try to access the file containg this code
in browser. However, this code does not work if I include the file
containing this code.
推荐答案
userid,time() +(60 * 60 * 24 * 30),/); -------------
userid,time()+(60*60*24*30 ),"/"); -------------
设置cookie
Sets the cookie
读取饼干
to read the cookie
MyUserId =
MyUserId =
_COOKIE [''TestCookie'']; -------------------------设置
变量
_COOKIE[''TestCookie'']; -------------------------Sets
the variable
这篇关于IE7中的Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!