当我通过单击 [x](不是 onunload)关闭页面时,如何取消设置 SESSION。我想在打开页面和关闭时插入,但我不想在刷新时插入。
if (!isset($_SESSION["visits"]))
$_SESSION["visits"] = 0;
$_SESSION["visits"] = $_SESSION["visits"] + 1;
if ($_SESSION["visits"] > 1){echo "You hit the refresh button!";}
else{
mysql_query(
"INSERT INTO najd_visit( visit_userId, visit_staticId, visit_page,
visit_enterTime)VALUES ('$userId', '$Sid', '$title', '$date') ");
echo "This is my site";
//unset($_SESSION["visits"]);
}