$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(){}
不要出現(xiàn)
success
error
$needSuspend = !isset($options['success']) && class_exists(EventLoop::class, false);
網(wǎng)絡(luò)請求錯誤雖然是代碼邏輯的一部分 但是webman/http-client 攜程用法暫時不支持處理,使用時候一定要注意
如果你使用該插件 請求一個網(wǎng)址 超時/錯誤/連接不上會導(dǎo)致 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]