Heim >Backend-Entwicklung >PHP-Tutorial >ignore_user_abort(1) 且set_time_limit(0)然后设置了无限循环,如何终止呢?
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);