doushangan3690 2012-03-19 03:16
浏览 73
已采纳

Php cookie没有设置

Alright I'm totally baffled.

Here's my code:

if ($password == $correct_password[0] && !isset($_COOKIE['user'])) {
            setcookie("user", $email, time() + 3600);
            var_dump(isset($_COOKIE['user']));
            echo "!";
        }

So it's doing the var_dumps, meaning that the setcookie should called. But the line right after it (checking if it's set) says it's not set!

If anyone could point out the problem it'd be greatly appreciated. Thanks

  • 写回答

4条回答 默认 最新

  • doujiaohuo1096 2012-03-22 16:21
    关注

    Still didn't find a solid valid answer, but after endless hours of testing it seems like something with the time. If I set the expiration date too close to the real time, maybe it doesn't register or something. It seemed to work when I set the time further, but I'm taking a break before heavy testing again. Thanks

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 高维数据处理方法求指导
  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错
  • ¥15 能把水桶搬到饮水机的机械设计
  • ¥15 Android Studio中如何把H5逻辑放在Assets 文件夹中以实现将h5代码打包为apk
  • ¥15 使用小程序wx.createWebAudioContext()开发节拍器
  • ¥15 关于#爬虫#的问题:请问HMDB代谢物爬虫的那个工具可以提供一下吗
  • ¥15 vue3+electron打包获取本地视频属性,文件夹里面有ffprobe.exe 文件还会报错这是什么原因呢?
  • ¥20 用51单片机控制急停。