在按照文檔例子使用協(xié)程時(shí)發(fā)生如下報(bào)錯(cuò)
public function Test1()
{
Coroutine::create(function(){
Timer::sleep(1.5);
echo "hello coroutine\n";
});
return response('hello webman');
}
Error: Class "Swoole\Coroutine" not found in /mnt/g/PHPDevelop/WebManProjects/webman-tools-api/ToolApi/vendor/workerman/workerman/src/Events/Swoole.php:59
config/process.php中通過(guò)eventLoop配置協(xié)程驅(qū)動(dòng)
看文檔
http://wtbis.cn/doc/webman/coroutine/coroutine.html