What are HTML tags, HTML entities

Source: Internet
Author: User
Tags html tags

Why do I need to convert
Simpler, because sometimes we need to display the HTML tag in the browser page, but the direct output <script>alert (1) </script>, when browsing the page will be implemented as HTML tag language, the workaround is to HTML tags are converted into HTML entities and then written into code, such as we want to display <script> alert (1) </script>, then our code should write: &lt;script&gt; $nbspalert (1) &lt;/script&gt;. Why is there a &nbsp; in the middle? Because the attentive friend may have found out, I have a space in the middle of <script> and alert, that is to say,&nbsp; is the entity name of the space.
Crossing might have said, since code &lt;script&gt; $nbspalert (1) &lt;/script&gt; The <script> alert (1) </script> is displayed, so if you want to display

&lt;script&gt; $nbspalert (1) &lt;/script&gt; What kind of code should I write? The reason is very simple, a paragraph of text, if the display in the page with the code is inconsistent, it must be included in the HTML keyword, such as the previous code contains the keyword &, if you want to display in the browser & (HTML keyword), You need to replace the,& entity with its corresponding entity in your code for &amp; , so to display &lt;script&gt; $nbspalert (1) &lt;/script&gt; , the code required is &amp;lt;script&amp;gt; $amp; Nbspalert (1) &amp;lt;/script&amp;gt;
The following symbol lists the HTML entities:
PHP HTML Series functions
Look at the above, you may feel, wow, that every time to change, the eyes are looking at the flowers, there is nothing simple and error-prone method. The answer is yes, humans are so lazy, anything can be done in a convenient way.
The functions of the PHP HTML series are
The above four functions are prefixed with HTML, so I think I know the HTML tag. where Html_entity_decode () and Htmlspecialchars_decode () are converting HTML entities to HTML tags, htmlspecialchars () and htmlentities () are converting HTML tags is an HTML entity.

What are HTML tags, HTML entities

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.