使用file_get_contents跳过行?

all*_*skd 3 php file-processing

我试图跳过前两行(从阅读3个文件)然后保存回来(我已经完成了这一切,剩下的就是跳线)

有没有办法做到这一点?

Dom*_*nes 6

这是一种方法.也许它有点矫枉过正,因为它效率不高.(使用file()会更快)

$content = file_get_contents($filename);
$lines = explode("\n", $content);
$skipped_content = implode("\n", array_slice($lines, 2));
Run Code Online (Sandbox Code Playgroud)