Htmlentities () single double quotation marks do not convert solution

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.