@@ -66,6 +66,30 @@ $ws_worker->onMessage = function($connection, $data)
Worker::runAll();
```
+### Timer
+test.php
+```php
+require_once './Workerman/Autoloader.php';
+use Workerman\Worker;
+use Workerman\Lib\Timer;
+
+$task = new Worker();
+$task->onWorkerStart = function($task)
+{
+ // 2.5 seconds
+ $time_interval = 2.5;
+ $timer_id = Timer::add($time_interval,
+ function()
+ {
+ echo "Timer run\n";
+ }
+ );
+};
+// run all workers
+Worker::runAll();
+```
run width
```php test.php start```