Workerman\Http\Client 携程用法导致代码不可用

youfeed

协程用法

    $response = $http->request('https://example.com/', [
        'method' => 'POST',
        'version' => '1.1',
        'headers' => ['Connection' => 'keep-alive'],
        'data' => ['key1' => 'value1', 'key2' => 'value2'],
    ]);
    echo $response->getBody();

错误不能捕获

这种写法 目前不支持 不能捕获报错

try {
$http->request('https://example.com/')
}catch(){}

协程用法 配置参数

不要出现 success error

$needSuspend = !isset($options['success']) && class_exists(EventLoop::class, false);

网络请求错误虽然是代码逻辑的一部分 但是webman/http-client 携程用法暂时不支持处理,使用时候一定要注意

249 2 0
2个回答

youfeed

如果你使用该插件 请求一个网址 超时/错误/连接不上会导致 webman 蹦出去重启

#15 {main}
finally 
process C:\Users\zzd\Desktop\micateam\admin.console\start.php terminated and try to restart
webman                                          http://0.0.0.0:6789                 1           [ok]
  • 暂无评论
youfeed

已修复 网络错误 超时从而导致 插件无限重启报错的问题

等待老大修复合并

🔝