脚本应该在第二次加载页面时运行

script should run when the page is loaded for the second time

本文关键字:运行 加载 第二次 脚本      更新时间:2023-09-26

此代码用于每周运行一次脚本。

<?php
$expire=time()+60*60*24*30; 
setcookie("count", "yes", $expire);
if (isset($_COOKIE["count"]))
$fb="none()";
else
$fb="facebook()";
?>

我希望以这样一种方式加载相同的内容,即第一次忽略脚本并在第二次运行。从那时起,整个星期都没有脚本调用。

尝试在cookie设置之前取消设置

unset($_COOKIE['count']); //or simple set cookie with numm time experies like setcookie('count','','0')
$expire=time()+60*60*24*30; 
setcookie("count", "yes", $expire);
if (isset($_COOKIE["count"]))
    $fb="none()";
else
    $fb="facebook()";