Event::addTimer
Event::addTimer
(PECL event >= 1.2.6-beta)
Event :: addTimer - 使计时器事件悬而未决
描述
public bool Event::addTimer ([ double $timeout ] )
Event :: addTimer()
是 Event :: add()的别名
返回值
例子
示例#1 Event :: addTimer()示例
<?php
$base = new EventBase(
$n = 2;
$e = Event::timer($base, function($n) use (&$e) {
echo "$n seconds elapsed\n";
$e->delTimer(
}, $n
$e->addTimer($n
$base->loop(
?>
上面的例子会输出类似于:
2 seconds elapsed
也可以看看
- Event :: add() - 使事件悬而未决
- Event :: del() - 使事件处于非挂起状态
- Event :: delTimer() - 使计时器事件处于非挂起状态
← Event::addSignal
Event::__construct →