SetCookie("user","$username",0,"/");
后,当浏览器关闭时cookie不保存成文件。只要你再入时SetCookie前并无cookie变量“清除怎么不起作用呀”是什么意思?

解决方案 »

  1.   

    点击"注销"就清除cookie,
       setcookie("user","",0,"/");登陆时,判断cookie值是否存在.
       $user = $_COOKIE['user'];
       if( empty($user) ){
              echo "请登陆!........";     //填写用户名,密码之类的东东,
       }else{
              echo "欢迎";
              setcookie("user",$user,0,"/");
       }
      

  2.   

    setcookie("user","",now,"/");
    只要关闭了网页,就自动清除了
      

  3.   

    setcookie(”user“)直接这样也可以吧