swoole(v4.4.16) 协程 curl

Swoole\Runtime::enableCoroutine(true, SWOOLE_HOOK_ALL | SWOOLE_HOOK_CURL);
    for ($i = 0; $i <= 20; $i++) {
        go(function () use ($i){
           //   sleep(2);
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, 'http://116.62.45.127/index.php?a='.$i);
            curl_setopt($ch, CURLOPT_HEADER,0);
            curl_exec($ch);
            curl_close($ch);
        });
    };

你可能感兴趣的:(swoole(v4.4.16) 协程 curl)