Htmlentities () single double quotes do not convert PHPcode & lt ;? Php $ str & quot; John & amp; Adams & quot; echohtmlentities ($ str, ENT_COMPAT); echo & quot; & lt; br & gt; & quot ;; echohtmlentities ($ str, ENT_QU htmlentities () single double quotation marks are not converted
PHP code
";echo htmlentities($str, ENT_QUOTES);echo "
";echo htmlentities($str, ENT_NOQUOTES);?>
Why do I not convert single double quotes ??
The following is my browser output
HTML code
John & 'Adams'
John & 'Adams'
John & 'Adams'
------ Solution --------------------
So what are the headers?
------ Solution --------------------
? ENT_COMPAT-default. Only double quotation marks are encoded.
? ENT_QUOTES-encode double quotation marks and single quotation marks.
? ENT_NOQUOTES-do not encode any quotation marks.
------ Solution --------------------
'Is single quotes
------ Solution --------------------
It is estimated that the author looks at the HTML display in the browser, rather than the HTML source code.