PHP - How to replace a phrase with another?

前端 未结 4 611
半阙折子戏
半阙折子戏 2020-12-21 11:40

How can i replace this

with this

easiest with PHP.



        
4条回答
  •  猫巷女王i
    2020-12-21 12:20

    The reason not to parse HTML with regex is if you can't guarantee the format. If you already know the format of the string, you don't have to worry about having a complete parser.

    In your case, if you know that's the format, you can use str_replace

    str_replace('

    ', '

    ', $data);

提交回复
热议问题