php

embluk

·

Swoole Task Scheduler

·

PHP

·

Total Size: 814 B

·

·

Created: 1 year ago

·

Edited: 1 year ago

<?php $count = 0; function test($timerid, $param) { global $count; $count++; var_dump($count); if($count >= 10) { swoole_timer_clear($timerid); } } swoole_timer_tick(1000, "test",["param1", "param2"]);

The swoole server provides the methods swoole_server->tick and swoole_server->after to realize the asynchronous timer. For the swoole client, the swoole also provides the functions to realize the asynchronous timer. These schedule functions are accurate to milliseconds.

Cancel the timer tick or one time tick. Alias of function swoole_timer_clear.

More info at: https://www.swoole.co.uk/docs/modules/swoole-scheduler

1 bit

430 views

Are you sure you want to delete?