strip_tags 的问题

WBOY
Release: 2016-06-23 14:03:34
Original
716 people have browsed it

我有一篇文章,内容很多,但是内容要经过下面的处理。

$text = strip_tags($text, '

    • strip_tags 的问题

      <script>'); <br /> <br /> 也就是说,内容只能保留上面那些标签,其他的标签会被去掉。 <br /> 问题就来了,文章里面字符串中含有<= => 这样的字符,就会被认为是一种标签,内容会被无故去掉。请问如何解决这个问题?此外,需要说明的是,也许另一篇文章就不是<=标签而是其他了。 <p> </script>


    回复讨论(解决方案)

    那你就自己写代码一个个的删喽
    预设的函数是不可能解决你所有的问题的,都能解决那还要你做什么?

    那你就自己写代码一个个的删喽
    预设的函数是不可能解决你所有的问题的,都能解决那还要你做什么?

    说了半天还是没说怎么解决。那是discuz转换html变成ubb的函数。

    弄一个数组,要转换的匹配每个标签内容的正则放入数组。然后preg_replace

    弄一个数组,要转换的匹配每个标签内容的正则放入数组。然后preg_replace
    那就只能用正则去匹配了。

    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!