php read large text file log

后端 未结 5 1731
时光说笑
时光说笑 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:26

    Loading that size file into memory would probably not be a good idea. This should get you around that.

    $file = escapeshellarg($file);
    $line = 'tail -n 18 '.$file;
    system($line);
    

提交回复
热议问题