只读取大型文本文件的最后50行 [英] Reading ONLY the last 50 lines of a large text file
问题描述
我的服务器上有一个非常大的日志文件,我想在我的网站上持续更新控制台视图,只显示文件的最后50行
I have a pretty large log file on my server, and i would like to have a continually updating console view on my website, showing only the last 50 or so lines of the file
问题是每次加载整个文件需要太长时间,所以我需要一种方法来加载nescsarry行(如果可能的话)或其他解决方案。
the problem is that it takes too long to load the entire file every time, so i need a way to load only the nescsarry lines, (if possible) or another solution that works.
预先感谢
thanks in advance
推荐答案
我会说这是完全重复(如约翰孔德提到的),除非你想做客户端在这种情况下,maaaybe,也许你可以用 HTTP字节服务来完成。
I'd say it's an exact duplicate (as John Conde mentioned), unless you want to do it client-side, in which case maaaybe, just maybe, you could do it with HTTP byte serving.
我建议你用PHP来做这件事,所以请阅读这个问题。
I do recommend you do this with PHP, so read that question.
这篇关于只读取大型文本文件的最后50行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!