0

こんにちは、マルチスレッド クラスを使用してリストからメールを取得しています

使用してfile_get_contents("http://server.com/getemails.php");

これはgetemails.phpです:

index = file("index.dat");
$index = $index[0];
$f_contents = file("../susc/ar.txt");
$line = $f_contents[$index];
$data = $line;

file_put_contents("index.dat",$index +1);

echo $data;

「../susc/ar.txt」から、ファイルに次のような100.000行のデータが取得されます。

sampleuser@hotmail.com
suscribeduser@hotmail.com
exampleemail@hotmail.com
...

しかし、プログラムをマルチスレッドで実行すると、多くの電子メールが繰り返されます

このような:

[Thread][t11] -> sampleuser@hotmail.com

[Thread][t12] -> sampleuser@hotmail.com

[Thread][t8] -> sampleuser@hotmail.com

[Thread][t1] -> sampleuser@hotmail.com

[Thread][t2] -> sampleuser@hotmail.com

[Thread][t5] -> suscribeduser@hotmail.com

[Thread][t3] -> suscribeduser@hotmail.com

[Thread][t6] -> suscribeduser@hotmail.com

[Thread][t7] -> suscribeduser@hotmail.com

[Thread][t4] -> suscribeduser@hotmail.com

[Thread][t14] -> exampleemail@hotmail.com

[Thread][t9] -> exampleemail@hotmail.com

[Thread][t10] -> exampleemail@hotmail.com

私の質問は、テキストファイルから行を取得し、次の要求で繰り返さないために使用できる方法は何ですか

4

0 に答える 0