i have names.txt
例如:name1 n'
name2 n'
name3 n'
name87 n'
name4e n'
我将这个get方法通过name。txt
php.com/test.php?name=name1
php.com/test.php?name=name2
...
php.com/test.php?name=name3e
name.txt
我的代码是
$test = file_get_contents('name.txt'); // i need to use all name array in name.txt
,然后在while中打开它到PHP打开所有名称在name。txt
和结束后的名称在name.txt中完成,而停止
file_get_contents($test');
谢谢
有一个名为file()
的php函数,它将文件的所有行读取为数组,因此无需从换行分隔的字符串中读取file_get_contents()
$lines = file('name.txt');
// Loop through our array, and build (n) cURL connections
foreach ($lines as $line_num => $line) {
// Do your cURL stuff in here
}