Home > Backend Development > PHP Tutorial > php filter all HTML tags_PHP tutorial

php filter all HTML tags_PHP tutorial

WBOY
Release: 2016-07-20 11:01:44
Original
1095 people have browsed it

The article provides you with two PHP methods to filter all HTML tags. It can filter all HTML tags. ​

The article provides you with two php tutorials to filter all html tags. It can filter all html tags.

//Remove html tags

function text2html($txt){
          $txt = str_replace(" "," ",$txt);
          $txt = str_replace("<","<",$txt);
          $txt = str_replace(">",">",$txt);
          $txt = preg_replace("/[ ]{1,}/isu","
",$txt);
         return $txt;
}

//Clear html tag

function clearhtml($str){
           $str = str_replace('<','<',$str);
$str = str_replace('>','>',$str);
         return $str;
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445419.htmlTechArticleThe article provides you with two php methods to filter all HTML tags. It can filter all html tags. The article provides you with two php tutorials to filter all html tags. It can filter all...
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