|
復(fù)制代碼 代碼如下:
ignore_user_abort(true); //設(shè)置客戶端斷開連接時(shí)是否中斷腳本的執(zhí)行
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);
php技術(shù):瀏覽器關(guān)閉后,能繼續(xù)執(zhí)行的php函數(shù)(ignore_user_abort),轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。