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