$serv=new swoole_server('127.0.0.1',9501);
$serv->set(array('task_worker_num'=>4));
$serv->on("receive",function($serv,$fd,$from_id,$data){
$task_id=$serv->task($data);
echo "异步id{$task_id}\n";
});
$serv->on("task",function($serv,$task_id,$from_id,$data){
echo "执行异步id为$task_id\n";
$serv->finish("{$data}->ok");
});
$serv->on("finish",function($serv,$task_id,$data){
echo "完成\n";
});
$serv->start();
swoole 异步
最新推荐文章于 2023-09-25 10:35:21 发布