php – 使用file_get_contents跳过行?
作者:互联网
我试图跳过前两行(从阅读3个文件)然后保存回来(我已经完成了这一切,剩下的就是跳线)
有没有办法做到这一点?
解决方法:
这是一种方法.也许这有点矫枉过正,因为它效率不高. (使用file()会快得多)
$content = file_get_contents($filename);
$lines = explode("\n", $content);
$skipped_content = implode("\n", array_slice($lines, 2));
标签:file-processing,php 来源: https://codeday.me/bug/20190730/1579716.html