从php中删除textfile中的内容

时间:2015-08-26 12:31:48

标签: php

我有一个包含一些文本的文本文件:

first line
hello world
hello world
hello world
hello world hello world hello world

我想从我的文件中删除与我文件中的first line匹配的文本。

如何才能使用php?

1 个答案:

答案 0 :(得分:0)

读取您的文本文件并将其存储在变量中,然后使用正则表达式查找该行,将其删除并将其写回您的文件


regex
preg_replace