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

前端 未结 10 966
日久生厌
日久生厌 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条回答
  •  -上瘾入骨i
    2020-12-08 07:28

    $string      = '

    Foo

    bar'; $spaceString = str_replace( '<', ' <',$string ); $doubleSpace = strip_tags( $spaceString ); $singleSpace = str_replace( ' ', ' ', $doubleSpace );

提交回复
热议问题