是否可以计算Guzzle 4或5创建的GET请求的字节数/秒?
如果是这样,这是怎么做到的?
答案 0 :(得分:0)
要回答您的问题,是的,可以计算数据速率。
假设使用Guzzle 5,以及ProgressEvent上的Guzzle Documentation on Events:
您可以使用相应的方法访问发出的进度值 事件对象的公共属性:
$downloadSize: The number of bytes that will be downloaded (if known) $downloaded: The number of bytes that have been downloaded $uploadSize: The number of bytes that will be uploaded (if known) $uploaded: The number of bytes that have been uploaded
理论上使用EventSubscriber(整洁,整洁和推荐)或通过将闭包传递给事件发射器(不那么整洁)是: