PHP translates HTML into text implementation code,
Core code:
<?php//$document should contain an HTML document. This example removes HTML tags, javascript code//and white space characters. Some common//HTML entities are also converted to the appropriate text. $search = Array ("' Si ',//Remove JavaScript " ' <[\/\! ") *? [^<>]*?> ' Si ', //Remove HTML tag "' ([\ r \ n]) [\s]+ '", //Remove blank character "' & (quot| #34); ' I ", //Replace HTML entity " ' & (amp| #38); ' I ", " ' & (lt| #60); ' I ", " ' & (gt| #62); ' I ", " ' & (nbsp| #160); ' I ", " ' & (iexcl| #161); ' I ", " ' & (cent| #162); ' I ", " ' & (pound| #163); ' I ", " ' & (copy| #169); ' I ", " ' "(\d+); E "); Run as PHP code $replace = Array ("", "", "\\1", "\" ", " & ", " < ", " > "," ", Chr (161), Chr (162), Chr (163), Chr (169), "Chr (\\1)"); $text = Preg_replace ($search, $ Replace, $document);? >
http://www.bkjia.com/PHPjc/945695.html www.bkjia.com true http://www.bkjia.com/PHPjc/945695.html techarticle PHP converts HTML into text implementation code, the core code: php//$document should contain an HTML document. This example removes HTML tags, javascript code//and white space characters. It's going to be ....