当前位置 : 主页 > 网络编程 > PHP >

php实现毫秒级定时器

来源:互联网 收集:自由互联 发布时间:2021-06-28
swoole-worker毫秒级定时器代码 onWorkerStart = function (Worker $worker) { Timer::add(2,function(){ echo time(); },[],true);};$worker-count = 1;Worker::$logFile = __DIR__ . '/workerman.log';Worker::$pidFile = __DIR__ . "/" . str_repl
swoole-worker毫秒级定时器代码
 onWorkerStart = function (Worker $worker) {
   Timer::add(2,function(){
       echo time();
    },[],true);

};
$worker->count = 1;
Worker::$logFile = __DIR__ . '/workerman.log';
Worker::$pidFile = __DIR__ . "/" . str_replace('/', '_', __FILE__) . ".pid";
// 运行所有服务
Worker::runAll();
/**
https://gitee.com/FEIGE/swoole-worker
*/
网友评论