【发布时间】:2018-09-09 22:38:26
【问题描述】:
在 guzzle6 手册 (http://guzzle.readthedocs.org/en/latest/quickstart.html#exceptions) 中指出
如果 http_errors 请求选项设置为 true,则会针对 400 级错误抛出 GuzzleHttp\Exception\ClientException
这个“http_errors”设置是什么,如何更改?
我试过了:
$client = new \Guzzle\Http\Client();
$client->setDefaultOption('http_errors', false);
我不确定这是否有任何影响。除此之外,我在库源代码的任何地方都找不到字符串“http_errors”,这让我怀疑我误解了文档。
那么我该如何更改这个“http_errors”设置/请求选项?
【问题讨论】:
-
对于 guzzle6:
$client->get('/status/500', ['http_errors' => false]);(guzzle.readthedocs.org/en/latest/…)