PHP Str_replace Replace multiple sensitive words "nasty"

Source: Internet
Author: User
PHP Str_replace Replace multiple sensitive words "nasty, online etc."
This post was last edited by u011123799 on 2013-06-19 12:42:46


$html = htmlreplace ($body, 0);Filter

echo $html;The output is: <pre class= "Lang-js" >
Compile into HTML:



/************* above for background *************/

$html = Str_replace ("<pre class=" Lang-js ">", "
", Htmlreplace ($body, 0)) 

This will output properly after the replacement, but the problem comes!

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

    It's silly to write one of these! Is there any way to define what you want to replace at once?

    such as:
    <span> =
    <ul> =

      <li> =


    • Novice

      br> PHP Palm? Pre HTML

      share to:


      ------ Solution--------------------
      Echo htmlspecialchars_decode ($html, ent_quotes);
      ------Solution--------------------
      #1是专门对付html标签的
      You can also use arrays and regular

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.