Ai
1 Star 0 Fork 0

呼啦啦的圈/phpworkerman-chat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ws_test2.php 481 Bytes
一键复制 编辑 原始数据 按行查看 历史
天空的味道 提交于 2023-10-11 01:22 +08:00 . first commit
<?php
use Workerman\Worker;
use Workerman\Timer;
require_once __DIR__ . '/vendor/autoload.php';
$task = new Worker("websocket://127.0.0.1:2000");
// 开启多少个进程运行定时任务,注意业务是否在多进程有并发问题
$task->count = 1;
$task->onWorkerStart = function(Worker $task)
{
// 每2.5秒执行一次
$time_interval = 2.5;
Timer::add($time_interval, function()
{
echo "task run\n";
});
};
// 运行worker
Worker::runAll();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/hula-hoop/phpworkerman-chat.git
git@gitee.com:hula-hoop/phpworkerman-chat.git
hula-hoop
phpworkerman-chat
phpworkerman-chat
master

搜索帮助