$c = $_COOKIE["count"];
$c++;
setcookie("count", $c, time() + 86400, '/test', "localhost");
echo $_COOKIE["count"];
ob_flush();
flush();
?>
this is problem when change url exampl开发者_JAVA技巧e
http://www.example.com/test1 count=2
http://www.example.com/test3 count=1
http://www.example.com/test2 count=7
but i would like count only same url ?
It's the way you store the $_COOKIE.
setcookie("count", $c, time() + 86400, '/', 'yoursite.com');
The cookies you were storing will belong to that page only. This will make them accessible to the whole domain by defining a folder and domain.
精彩评论