public static function onWorkerStart($bk) { if ($bk->id == 0) { global $worker; $worker = new TestWorker(); } } global $worker; Log::info('onMessage:msg:', ); 用户进入房间 在onMessa...
在 onWorkerStart 里面定义了 个全局的 global $_downTimer; 然后在 Timer 里面倒计时 代码如下 global $_downTimer; $_downTimer = 60; $_timer = Timer::add(1, function () use (&$_timer,&$_downTimer) { if($_downTimer == 0){...