Guzzle 6 - 获取请求总时间 [英] Guzzle 6 - Get request total time

查看:769
本文介绍了Guzzle 6 - 获取请求总时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索以在简单的GET请求后在Guzzle 6中检索请求总时间:

I'm searching to retrieve the request total time in Guzzle 6, just after a simple GET request :

$client = new GuzzleHttp\Client();
$response = client->get('http://www.google.com/');

但在文档中找不到任何东西。任何想法?

But can't find anything in the docs about that. Any idea ?

非常感谢。

推荐答案

.0您可以使用'on_stats'请求选项获取传输时间等。

In Guzzle 6.1.0 You can use the 'on_stats' request option to get transfer time etc.

更多信息可以在请求选项 - on_stats

https://github.com/guzzle/guzzle/releases/tag/6.1.0

这篇关于Guzzle 6 - 获取请求总时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆