Php converts HTML to text .? Php $ document should contain an HTML document. In this example, the HTML tag, javascript code, and blank characters are removed. Some common HTML entities will be converted into corresponding text
-
Php
// $ Document should contain an HTML document.
// In this example, the HTML tag and javascript code are removed.
// And blank characters. Some common
// Convert the HTML object to the corresponding text.
$ Search = array ("' ] *?>. *? Script 'Si ", // remove javascript
"'<[/!] *? [^ <>] *?> 'Si ", // remove the HTML tag
"'([Rn]) [s] +'", // remove the white space
"'& (Quot | #34);' I", // replaces the HTML object
"'& (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 (1, 161 ),
Chr (1, 162 ),
Chr (1, 163 ),
Chr (1, 169 ),
"Chr (1 )");
$ Text = preg_replace ($ search, $ replace, $ document );
?>
Http://www.bkjia.com/PHPjc/371955.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/371955.htmlTechArticle? Php // $ document should contain an HTML document. // In this example, the HTML tag, javascript code //, and blank characters are removed. Some common // HTML objects will be converted into the corresponding text...