]+>/','', $_str);" can be removed."/> ]+>/','', $_str);" can be removed.">
Home >Backend Development >PHP Problem >How to remove html with php regular expression
php regular expression method to remove html: first use "htmlspecialchars_decode" to convert the special HTML entities back to ordinary characters; then use the regular expression "preg_replace('/5e77056087f18f3abd310ca37b0b1899] >/' ,'',$_str);" can be removed.
Recommended: "PHP Video Tutorial"
php regular removal of html tags
The code is as follows:
$_str = htmlspecialchars_decode($_str); $_str = preg_replace('/<\/?[^>]+>/','',$_str);
htmlspecialchars_decode - Convert special HTML entities back to ordinary characters
preg_replace function performs a regular expression search and replacement.
The above is the detailed content of How to remove html with php regular expression. For more information, please follow other related articles on the PHP Chinese website!