// 定时执行服务器上的函数,如定时生产静态页面的函数
// 用法:上传的服务器,用浏览器打开该PHP文件,然后关闭该页面,该PHP程序会在后台运行;
function executeHTML(){
// create html functions
}
ignore_user_abort(); // run script in background
set_time_limit(0); // run script forever
$interval = 60 * 60 * 10; // per function execute times (Unit : seconds) // 10 hours
do{
// executeHTML被调用后,并不关心该函数的执行时间,
// 而是直接跳到sleep函数执行,并不是等待该函数执行完毕后才执行 sleep
executeHTML();
sleep($interval);
}while(true)
// 用法:上传的服务器,用浏览器打开该PHP文件,然后关闭该页面,该PHP程序会在后台运行;
function executeHTML(){
// create html functions
}
ignore_user_abort(); // run script in background
set_time_limit(0); // run script forever
$interval = 60 * 60 * 10; // per function execute times (Unit : seconds) // 10 hours
do{
// executeHTML被调用后,并不关心该函数的执行时间,
// 而是直接跳到sleep函数执行,并不是等待该函数执行完毕后才执行 sleep
executeHTML();
sleep($interval);
}while(true)
//服务器上打卡开该页面,然后关闭该页面;该PHP会在后台运行;