ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### ignore_user_abort() ~~~ private $interval=60*10; /** * 账户刷新解禁 */ public function banStatusScan(){ /* * 内存限制 [ini_set('memory_limit','30M')] * 不限时间 [set_time_limit(0)] * 免掉线 [ignore_user_abort(true)] */ ini_set('memory_limit','30M'); set_time_limit(0); ignore_user_abort(true); //日志初始化 Log::init([ 'type' => 'File', 'path' => APP_PATH.'index/log/crontab/' ]); try{ while(1){ //允许循环判断 $run = Config::get('accountban_scan'); if(!$run) die('process abort'); // 查询账户的封禁状态 // 如果当前时间小于账号的解封时间,账号实际未封禁则请求账号封禁 // 如果当前时间大于账号的解封时间则请求账号解封 // 如果解封请求的返回结果为OK则删除封禁操作记录 $nowtime = time(); if(connection_status() != CONNECTION_NORMAL){ break; } // Sleep for 10 minutes sleep($this->interval); } } } catch (\Exception $e){ Log::write($e->getMessage(),'log'); throw new \think\Exception('异常消息:' . $e->getMessage()); } ~~~