时间:2021-07-01 10:21:17 帮助过:24人阅读
ignore_user_abort(true); //设置客户端断开连接时是否中断脚本的执行
set_time_limit(0);
$file = '/tmp/ignore_user.txt';
if(!file_exists($file)) {
file_put_contents($file);
}
if(!$handle = fopen($file,'a+b')){
echo "not open file :".$file;
exit;
}
$i=0;
while($i<100) {
$time = date("Y-m-d H:i:s",time());
echo $time."\n";
if(fwrite($handle,$time."\n")===false) {
echo "not write file:".$file;
exit;
}
echo "write file time:".$time."\n";
$i++;
sleep(2);
}
fclose($handle);
http://www.bkjia.com/PHPjc/325782.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325782.htmlTechArticle多的不说,直接上代码: 代码如下:
ignore_user_abort(true); //设置客户端断开连接时是否中断脚本的执行 set_time_limit(0); $file = '/tmp/ig...