// 获取文件指定行数的内容
function getFileLineHandle($fileName, $linePosition)
{
    $f = new \SplFileObject($fileName, 'r');
    $f->seek($linePosition);
    try {
        $content = $f->getCurrentLine();
        //$f->next();
    } catch (Exception $e) {
        // 若是行数超过文件总行数,获取异常
        $content = '';
    }

    return $content;
}

相关文章:

  • 2021-09-27
  • 2021-12-13
  • 2021-11-21
  • 2021-12-05
  • 2021-11-06
  • 2022-12-23
  • 2022-01-06
猜你喜欢
  • 2022-12-23
  • 2022-01-03
  • 2021-08-14
  • 2021-12-10
  • 2022-12-23
  • 2021-06-22
  • 2021-09-12
相关资源
相似解决方案