When the web editor writes articles to the database or reads the database content, there are often non-resolution issues and a lot of code, which is actually a problem of html entity and corresponding string conversion. It mainly involves htmlspecialchars (), htmlentities (), htmlspecialchars _... "/> <scripttype =" text/javasc
When the web editor writes articles to the database or reads the database content, there are often non-resolution issues and a lot of code, which is actually a problem of html entity and corresponding string conversion.
It mainly involves functions such as htmlspecialchars (), htmlentities (), and htmlspecialchars_decode.
The htmlspecialchars () function converts some predefined characters into HTML objects.
The predefined characters are:
& (And number) become &
"(Double quotation marks)"
'(Single quotes)'
<(Less than) becomes <
> (Greater than) become>
PHP htmlentities () function
Definition and usage
The htmlentities () function converts characters to HTML objects.
Syntax
Htmlentities (string, quotestyle, character-set)
Note the differences between the two.
PHP htmlspecialchars_decode () function
Definition and usage
The htmlspecialchars_decode () function converts some predefined HTML entities into characters.
The HTML entity to be decoded is:
& Became & (and)
"Become" (double quotation marks)
'Become '(single quotes)
<Become <(less)
> Become> (greater)