私人领地

swoole 定时器

timer.php

<?php
//创建websocket服务器对象,监听0.0.0.0:9502端口
$ws = new swoole_server("0.0.0.0", 9503);

swoole_timer_tick(2000, function ($timer_id) {
    echo "执行第一次,\n";
});

 

启动

# php timer.php

 

posted @ 2018-08-09 11:58  狂奔的蜗牛Snails  阅读(268)  评论(0)    收藏  举报