phppopen兑现多任务
php popen实现多任务
/dev/null 2>&1';
$t1 = microtime(1);
for($i = 0 ; $i < $update_num ; $i++){
if($p_num <=0){
$fp1 = popen($line_cmd,'r');
//current shell process numbers
$line = fread($fp1,512);
pclose($fp1);
//processes can be pushed
$p_num = $limit - $line;
if($p_num <= 0 ){
usleep(100);
}
}
$p_num = $p_num -1;
$cmd = sprintf($exec_cmd,$i);
$fp = popen($cmd,'r');
pclose($fp);
}
$t2 = microtime(1);
echo round($t2 - $t1,2);
?>
/phprm/39854.htmlwww.phpzy.comtrue/phprm/39854.htmlTechArticlephppopen兑现多任务 php popen实现多任务 /dev/null 2>$t1 = microtime(1);for($i = 0 ; $i...
PHP之友评论