-
Php
$document should contain an HTML document.
This example removes the HTML tag, and the JavaScript code
and white space characters. will also be some of the common
The HTML entity is converted to the appropriate text.
$search = Array ("' Si",//Remove JavaScript
"' <[/!] *? [^<>]*?> ' Si ',//Remove HTML tags
"' ([RN]) [s]+ '",//Remove whitespace characters
"' & (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/371955.html www.bkjia.com true http://www.bkjia.com/PHPjc/371955.html techarticle ? A PHP//$document should contain an HTML document. This example removes HTML tags, javascript code//and white space characters. Some common//HTML entities will also be converted to the corresponding text ...