你调用setcookie后有没有提示设置失败?你在其它页面是怎么读取cookie变量的?最好用$_COOKIE['key']方式获取

解决方案 »

  1.   

    cookie只有在同一个应用程序里(同一个站点)有效
      

  2.   

    设置cookie的页面和访问cookie是否在同一目录下?
    如果不是请在设置cookie时设置cookie的有效路径
    bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, int secure]]]]])path
    If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
      

  3.   

    如果整个站点好多文件都要用到cookie,而又不在一个文件夹下,应该怎么设啊?
      

  4.   

    1、贴出你的代码,不要让人去猜你是如何写的!
    2、cookie默认doamin为/。即cookie在同一浏览器进程中对网站所有的页面有效
      

  5.   

    <?setcookie("user",$username);
    setcookie("right",mysql_result($result,0,'qx'));
    setcookie("workname",mysql_result($result,0,'workname'));?>
    <script language=javascript>
    window.location.href='<?=$HTTP_SERVER_VARS['HTTP_REFERER'];?>';
    </script>
    我把生成cookie的文件放到跟目录下去了,cookie可以用了。现在的问题是我在我的机子上可以用,到别人的机子怎么也用不了啊!