How to get transfer time for Pool requests in guzzle6?
我想获取每个请求的传输时间。
如何将
http://docs.guzzlephp.org/en/latest/request-options.html#on-stats
我的代码:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?php use GuzzleHttp//{Pool, Client}; use GuzzleHttp//Psr7//{ Request, Response }; $httpClient = new Client(); $responses = Pool::batch($httpClient, $requests, [‘fulfilled’ => function($response, $index) { }); |
解决方案:
1
2 3 4 5 |
$responses = Pool::batch($httpClient, $requests, [‘fulfilled’ => function($response, $index) {
}, ‘options’ => [‘on_stats’ => function(TransferStats $stats) { |
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/268551.html