ファイルの内容の先頭行番号$開始、$制限スパンを取得します。

// 获取指定开始行数$page,跨度$step的文件内容
function getLine($file_name, $start, $limit)
{
    $f = new SplFileObject($file_name, 'r');
    $f->seek($start);
    $ret = "";
    for ($i = 0; $i < $limit; $i++) {
        try {
            $ret .= $f->getCurrentLine();
            $f->next();
        } catch (Exception $e) {
            break;
        }
    }
    return $ret;
}

おすすめ

転載: www.cnblogs.com/phonecom/p/10986473.html