walkor 10 жил өмнө
parent
commit
e9cf3cca33
1 өөрчлөгдсөн 24 нэмэгдсэн , 0 устгасан
  1. 24 0
      README.md

+ 24 - 0
README.md

@@ -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```