cookie的机制就是这样的!
第一次执行只是把值写入了机器,然后读的还是以前的COOKIE!

解决方案 »

  1.   

    Cookies is stroed on the client side, so when first time you run the program, there is no cookies on the client side, (notice: the program will finished running and then output, so at the time, your will get a null cookies value) when you run the program again, then you can get the value you set last time.
      

  2.   

    setcookie并不会修改当前$_COOKIE里的值。你得自己更改这个值。
      

  3.   

    function my_setcookie($var,$value)
    {
     setcookie($var,$value);
     $_COOKIE[$var]=$value;
    }
      

  4.   

    When you use setcookie() and echo $_COOKIE[] in a same page, before PHP send the page data to tell browsers set the cookie, it will first get the value of cookie added into the page data, so you will get the old cookie.
      

  5.   

    呃,好像是我自己的问题:)没有搞懂cookie的机制哈。
    再问个问题,,snoopy这个类在设置cookie的时候怎么设置它的过期时间和domain啊??