我想同时运行这段代码。在名为 id.txt 的目录中有一个 txt 文件,其中所有参数都在下面的标头中的 Cookie 中替换。如果我通过打开 10 个 cmd 选项卡来运行它,那么这个过程会变慢。所以请帮助我如何同时运行它或您的任何建议
$i=trim(file("index.txt")[0])+0;
$id=file("id.txt")[$i];
$idd=preg_replace('/\s+/', '', $id);
file_put_contents("index.txt",$i+1);
echo $idd;
while(true){
$url8 = "https://www.example.com/";
$header= array("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.5",
"Content-Type: application/x-www-form-urlencoded",
"Content-Length: 0",
"Cookie: $idd");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url8);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0");
curl_setopt($ch, CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
$out = curl_exec($ch);
echo "\n";
echo $currentTime = date( 'h i s', time () );
if(preg_match('/done/',$out)){
die(' done');
}
}