debug
摘要
设置成 true
或设置成一个 fopen()
返回的流来启用调试输出发送请求的处理器, 比如,当使用cURL传输请求,cURL的 CURLOPT_VERBOSE
的冗长将会发出, 当使用PHP流,流处理的提示将会发生。 如果设置为true,输出到PHP标准输出文件,如果提供了PHP流,将会输出到流。
类型
- bool
fopen()
resource
默认值
None
常量
GuzzleHttp\RequestOptions::DEBUG
$client->request('GET', '/get', ['debug' => true]);
执行上面的例子将会输出类似下面的结果:
* About to connect() to httpbin.org port 80 (#0)
* Trying 107.21.213.98... * Connected to httpbin.org (107.21.213.98) port 80 (#0)
> GET /get HTTP/1.1
Host: httpbin.org
User-Agent: Guzzle/4.0 curl/7.21.4 PHP/5.5.7
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json
< Date: Sun, 16 Feb 2014 06:50:09 GMT
< Server: gunicorn/0.17.4
< Content-Length: 335
< Connection: keep-alive
<
* Connection #0 to host httpbin.org left intact