各位我有一个数组$a = ;我现在要用定时器做个任务,获取时间戳,假如当前时间戳是10000,希望可以实现过1.5s后,打印时间戳为10001.5,再过2.8s后时间戳为10004.3怎么做
<?php require_once __DIR__ . '/vendor/autoload.php'; use Workerman\Lib\Timer; use Workerman\Worker; $start = '1000'; $task = new Worker(); $task->onWorkerStart = function ($task) { $a = ; foreach ($a as $val) { $timer_id = Timer::add($val, function ($param) { global $start; $start = bcadd($start, (string) $param, 1); echo $start . "\n"; } , , false); } }; // run all workers Worker::runAll();这样试试看