简体   繁体   English

PHP cookie在IE中不起作用

[英]PHP cookies not working in IE

I am creating a cookies using PHP, below is an example of one of the cookies: 我正在使用PHP创建cookie,以下是其中一种cookie的示例:

setcookie("LogPasswordError", "Please enter your Password.", time()+1, '/');

It is created in the file loginForm.php if the users password is incorrect this cookie if it is set is then echo'd out in the HTML form which is in a different file. 如果用户密码不正确,则在文件loginForm.php创建该cookie(如果已设置),然后在另一个文件的HTML表单中回显该cookie。 In IE the cookie is not being set however it works in Firefox and Chrome. 在IE中,未设置cookie,但它可在Firefox和Chrome中使用。 Why is the cookie not being set in IE? 为什么未在IE中设置cookie?

Which version of IE? 哪个版本的IE?

Try this if you are on localhost: 如果您在本地主机上,请尝试以下操作:

setcookie("LogPasswordError", "Please enter your Password.", time()+3600, '/', false ); setcookie(“ LogPasswordError”,“请输入您的密码。”,time()+ 3600,'/', false );

this means use current time plus 3600,and the false means not use https protocol. 这表示使用当前时间加上3600,而false表示不使用https协议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM