php 读取大文件最后一行

kevin.Zhu 发布于:2013-1-16 15:39 分类:Php  有 14 人浏览,获得评论 0 条  

# 定位到文件最后一行
fseek($fhandle, -2,SEEK_END)




示例: 

$fp = fopen('xxx', 'r'); 

fseek($fp, -2 , SEEK_END); 

$last_line_str = fgets($fp);