Find and replace in a file

前端 未结 4 569
醉话见心
醉话见心 2020-12-05 05:00

I want to replace certain strings with another one in a text file (ex: \\nH with ,H). Is there any way to that using PHP?

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 05:37

    If you're on a Unix machine, you could also use sed via php's program execution functions.

    Thus, you do not have to pipe all of the file's content through php and can use regular expressions. Could be faster.

    If you're not into reading manpages, you can find an overview on Wikipedia.

提交回复
热议问题