我看vendor里有 Illuminate\Support\Facades\Http;
但是 use Illuminate\Support\Facades\Http后使用報錯啦
有推薦的嗎
private function createClientPoolD($urls, $method)
{
$this->totalPageCount = count($urls);
$client = new Client();
$requests = function ($urls) use ($client,$method) {
foreach ($urls as $url){
//print_r($url['options']);
yield function () use ($url,$client,$method){
return $client->requestAsync($method, $url['url'], $url['options']);
};
}
};
$pool = new Pool($client, $requests($urls), [
'concurrency' => 100,
'fulfilled' => function ($response, $index) {
$this->successHandel($response, $index);
},
'rejected' => function ($reason, $index) {
$this->rejectHandel($reason, $index);
},
]);
return $pool;
}