/****config.php***/

<?php
     return 1;      //需要停止时改成0
?>

/******************/

ignore_user_abort();//关掉浏览器,PHP脚本也可以继续执行.
set_time_limit(0);// 通过set_time_limit(0)可以让程序无限制的执行下去
$interval=60*30;// 每隔半小时运行
do{
    $run = include 'config.php';
    if(!$run) die('process abort');
    //这里是你要执行的代码
    $file = "cron.txt";
    $content = "这是第".$i."次执行!\r\n";
    $fp = fopen($file, "a+");    
    fwrite($fp,$content);
    fclose($fp);
    $i++;
    sleep($interval);// 每隔半小时运行
     
}while(true);

 

相关文章:

  • 2022-03-02
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-02-02
  • 2021-12-17
  • 2022-12-23
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2021-08-14
  • 2022-02-07
  • 2022-12-23
  • 2021-10-07
  • 2022-01-31
  • 2021-11-20
相关资源
相似解决方案