PHP removing html tags from string

后端 未结 6 1831
小鲜肉
小鲜肉 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:33

    Try to put it like that

    $content = strip_tags($text);
    

    Or you can do it with regular expression like that:

    $content = preg_replace('/<[^>]*>/', '', $text);
    

    By this $content = strip_tags($text, '

    '); you are allowing the

    tag in the string.

    For more info see the link http://php.net/manual/en/function.strip-tags.php

提交回复
热议问题