swoole_server->after
在指定的时间后执行函数,需要swoole-1.7.7以上版本。
swoole_server->after(int $after_time_ms, mixed $callback_function);
swoole_server::after函数是一个一次性定时器,执行完成后就会销毁。
- $after_time_ms 指定时间,单位为毫秒
- $callback_function时间到期后所执行的函数,必须是可以调用的。callback函数不接受任何参数
- 低于
1.8.0
版本task进程不支持after定时器,仅支持addtimer
定时器
$after_time_ms 最大不得超过 86400000
此方法是swoole_timer_after函数的别名