ignore_user_abort(0); // run script in background set_time_limit(0); // run script forever $interval=2; // do every 15 minutes... do{ $data = '1<br/>'; file_put_contents('./test.html',$data,FILE_APPEND); sleep($interval); // wait 15 minutes }while(true);
cli模式下
<?php$pid = getmypid();ignore_user_abort(0);set_time_limit(0); $interval=200; do{ echo "$pid"; //获取pid sleep($interval);}while(true);
打错了,是
ignore_user_abort(1);
cli模式下
<?php$pid = getmypid();ignore_user_abort(0);set_time_limit(0); $interval=200; do{ echo "$pid"; //获取pid sleep($interval);}while(true);
cli模式下
<?php$pid = getmypid();ignore_user_abort(0);set_time_limit(0); $interval=200; do{ echo "$pid"; //获取pid sleep($interval);}while(true);