该脚本一次执行多个 URL,并自动回显 URL 的内容,我想阻止此脚本回显任何内容,但echo 'something';
除了我注释掉的行之外,我没有看到任何行。
这是脚本:
函数批处理执行($urls) { $i = 0; $块 = 数组(); $curl_handles = 数组(); foreach ($urls 作为 $url) { $curl_handles[$url] = curl_init(); curl_setopt($curl_handles[$url], CURLOPT_URL, $url); curl_setopt($curl_handles[$url], CURLOPT_CONNECTTIMEOUT, 100); } $curl_multi_handle = curl_multi_init(); foreach ($curl_handles 作为 $a_curl_handle) { $i++; curl_multi_add_handle($curl_multi_handle, $a_curl_handle); $block[] = $a_curl_handle; if (($i % 10 == 0) 或 ($i == count($curl_handles))) { $运行=空; 做 { $running_before = $running; curl_multi_exec($curl_multi_handle, $running); if ($running != $running_before) { // echo("正在等待 $running 站点完成...\n"); } } while ($running > 0); foreach ($block as $handle) { // $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); // $curl_errno = curl_errno($handle); $curl_error = curl_error($handle); 如果 ($curl_error) { // echo(" *** cURL 错误: ($curl_errno) $curl_error\n"); } curl_multi_remove_handle($curl_multi_handle, $handle); } $块 = 数组(); } } curl_multi_close($curl_multi_handle); }
帮助 :)