CURL多线程不执行一直在请求

代码如下
`
<?php

ini_set('max_execution_time',0);

for($i = 6055;$i >3055;$i--){

$connomains[] = 'http://www.xxxxx.com/index.php&id='.$i;

}

$mh = curl_multi_init();

foreach ($connomains as $i => $url) {

$conn[$i]=curl_init($url);
curl_setopt($conn[$i],CURLOPT_RETURNTRANSFER,1);
curl_multi_add_handle ($mh,$conn[$i]);

}

$active = null;
do {

$mrc = curl_multi_exec($mh, $active);

} while ($mrc == CURLM_CALL_MULTI_PERFORM);

while ($active && $mrc == CURLM_OK) {

if (curl_multi_select($mh) != -1) {
    do {
        $mrc = curl_multi_exec($mh, $active);
    } while ($mrc == CURLM_CALL_MULTI_PERFORM);
}

}

foreach ($connomains as $i => $url) {

$res[$i]=curl_multi_getcontent($conn[$i]);
$res[$i] = json_decode($res[$i],true);
var_dump($res[$i]);
curl_close($conn[$i]);

}
print_r($res);

?>
`

页面源地址是http://www.4wei.cn/archives/1001877

查看回复