drkug66408 2013-12-17 05:55
浏览 60
已采纳

如何使用cronjob每半小时运行一个PHP脚本[关闭]

How to run a Run a PHP Script for every half an hour with out cronjob ?

  • 写回答

3条回答 默认 最新

  • dousui7410 2013-12-17 06:03
    关注

    You can do it checking last update date for a file (that acts as flag).

    index.php (or any file)

    <?php
    $stat = stat("flag.txt");
    if(check if your $stat['mtime'] has more of 30 mins of last modification) {
     //run your script
     touch("flag.txt")
    }
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?