chaosxin 发表于 2017-3-30 07:39:33

PHP 中 COOKIE 的 怪 问 题 ?

  很早就发现有这问题,但是开始因为没用到,就忽略了,今天再次用到,才又想起来,写下来留待解决吧 :{?}
  
<?php
    setcookie(“test”, “This is a test Of PHP's Cookies on the Same Page”);
  if (isset($_COOKIE[“test”]))
  {
    echo $_COOKIE[“test”];
  }
  else
  {
    echo “The Cookie you Request is not Set yet”;
  }
?>
  页面执行后, 输出结果为: The Cookie you Request is not Set yet.
但是,用 SESSION 却可以得到正确的结果, 而且 ASP 中也不存在这个问题.
  原因我暂时没时间研究, 先留下记号吧.
页: [1]
查看完整版本: PHP 中 COOKIE 的 怪 问 题 ?