php read large text file log

后端 未结 5 1700
时光说笑
时光说笑 2020-12-10 22:04

I have a text log file, about 600 MB.

I want to read it using php and display the data on a html page, but I only need the last 18 lines that were added each time I

5条回答
  •  既然无缘
    2020-12-10 22:24

    Use fopen, filesize and fseek to open the file and start reading it only near the end of the file.

    Comments on the fseek manual page include full code to read the last X lines of a large file.

提交回复
热议问题