您好我也有高达30MB大小的文本文件,我想使用PHP脚本循环如何使用php脚本读取30MB文本文件?
$lines = file('data.txt');
//loop through each line
foreach ($lines as $line) { \\some function }
有什么办法来读取这个文件?我想打开它阅读PHP不允许我打开一个30MB的文件。通过线使用
$file = fopen("data.txt", "r") or exit("Unable to open file!");
while(!feof($file)) {
// do what you need to do with it - just echoing it out for this example
echo fgets($file). "<br />";
}
fclose($file);
那你想用的文件呢? – 2011-01-31 15:52:01
我想一行一行阅读,然后用文本文件中的信息处理数据,然后插入MySQl数据库 – leon 2011-01-31 15:56:02