Home > Article > Backend Development > Detailed introduction to regular expressions for filtering common html tags in PHP
PHP Use the htmlentities() function to convert HTML tags into Html entities
Definition and usage
htmlentities() function to convert characters into HTML entities .
Grammar
htmlentities(string,quotestyle,character-set)
PHP: Function to filter html tags (this is the most powerful)
PHP actually has internal functions available for filtering html tags, which is relatively simple. Stronger.
php function to filter html:
strip_tags(string)
<br/>
This way you can filter out all html tags.
If you want to filter out all html tags except
strip_tags(string,"");
, you can write like this:
xxx
To filter out all html tags except
strip_tags(string," ");Regular expressions for PHP to filter common html tags### In php project development, some regular expressions for filtering html tags are often used, save them for later use :###rrreee
The above is the detailed content of Detailed introduction to regular expressions for filtering common html tags in PHP. For more information, please follow other related articles on the PHP Chinese website!