PHPstr_replace replace multiple sensitive words (urgent]

Source: Internet
Author: User
PHPstr_replace replace multiple sensitive words [urgent, online, etc.] This post was last edited by u011123799 from 2013-06-1912: 42: 46 $ html & nbsp; htmlReplace ($ body, & nbsp; 0); & nbsp; filter echo & nbsp; $ html; the output content is: & amp; lt; pre & nbs PHP str_replace replaces multiple sensitive words [urgent, online, etc]

This post was last edited by u011123799 at 12:42:46


$ Html = HtmlReplace ($ body, 0); // filter

Echo $ html; // The output content is: <pre class = "lang-js">
// Compile it into HTML:



/************* The above background *************/

$ Html = str_replace ("<pre class =" lang-js "> ","
", HtmlReplace ($ body, 0 ))

After the replacement, the output is normal, but the problem arises!

I want to replace multiple tags, such :,
    ,
  • ...

    It's silly to write one by one! Is there any way to define the content required for replacement at a time?

    For example:
    <Span> =
    <Ul> =

      <Li> =


    • Beginner


      PHP Palm? Pre HTML

      Share:


      ------ Solution --------------------
      Echo htmlspecialchars_decode ($ html, ENT_QUOTES );
      ------ Solution --------------------
      #1 specifically deals with html tags
      You can also use arrays and regular expressions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.