PHP removing html tags from string

后端 未结 6 1835
小鲜肉
小鲜肉 2020-12-02 02:06

I have string:

Vers­lo cent­rai Lie­tu­vos ne­kil­no­ja­mo­jo turto plėt­ros aso­cia­ci­jos kon­kur­se ...

6条回答
  •  温柔的废话
    2020-12-02 02:18

    From PHP 7.4.0 the strip_tags() alternatively accepts an array with allowable tags,

    then this:

    text

    '; echo strip_tags($html, ['p', 'a']); //accept p and a tags

    Return this:

    text

    Note that only the disallowed tags have been removed.

提交回复
热议问题