dongzi3434 2008-11-05 13:17
浏览 65
已采纳

在PHP中读取大文件的最佳方法?

I have to read CSV files line by line wich can be 10 to 20 Meg. file() is useless ;-) and I have to find the quickiest way.

I have try with fgets(), wich run fine, but I don't know if it read a small block each time I call it, or if it cache a bigger one and optimize file I/O. Do I have to try the fread() way, parsing EOL by myself?

Thanks Cedric

  • 写回答

4条回答 默认 最新

  • dongsaohu6429 2008-11-05 13:23
    关注

    You ought to be using fgetcsv() if possible.

    Otherwise, there is always fgets().

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?