strip_tags() … replace tags by space rather than deleting them

前端 未结 10 965
日久生厌
日久生厌 2020-12-08 06:36

Do you know how to replace html tags with a space character using php?

If I display

strip_tags(\'

Foo

bar\');

10条回答
  •  离开以前
    2020-12-08 07:17

    preg_replace('#\<(.+?)\>#', ' ', $text);
    

    Bit late with answer but try this one, basically selects everything inside <> including the tags.

提交回复
热议问题