源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

浏览器关闭后,能继续执行的php函数(ignore_user_abort)

  • 时间:2022-04-18 16:33 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:浏览器关闭后,能继续执行的php函数(ignore_user_abort)
多的不说,直接上代码:
[u]复制代码[/u] 代码如下:
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);
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部