function text($fp,$n,$b=5) {if($n>0){$p = $n+1;$lines = array();while(count($lines)< =$n){try{
/SEEK_END - 设定位置为文件末尾加上 要移动到文件尾之前的位置,offset 必须是一个负值 /fseek($fp,-$p,SEEK_END);//$p 必须为负值} catch (Exception $e){fseek(0);break;}$p *= $b;while(!feof($fp)){array_unshift($lines,fgets($fp));//插入$lines 数组里}}return array_slice($lines,0,$n);//
}
}