PHP to remove HTML tags--strip

Source: Internet
Author: User
Tags html tags string format types of functions

Strip_tags
get rid of HTML and PHP tags.
Syntax: string strip_tags (String str);
return value: String
Types of functions: Data processing
Content Description
This function can remove any HTML and PHP tag strings contained in the string. If the HTML and PHP tags of the string are wrong, such as less than the symbol greater than, it will return the error. This function and FGETSS () have the same functionality.

Htmlspecialchars
converts a special character into HTML format.
Syntax: String htmlspecialchars (String string);
return value: String
Types of functions: Data processing
This function converts a special character into an HTML string format (&....;). The most commonly used occasions may be to deal with the message version of the customer message.
& (and) Convert to &
"(double quotes) into"
< (less than) turn into <
> (greater than) convert to >
"(single quotation mark) turn into '
This function converts only the special characters above, and does not convert all to the ASCII conversion specified by HTML.

Copy Code code as follows:
<?php
$new = Htmlspecialchars ("<a href= ' test ' >Test</a>", ent_quotes);
Echo $new;
?>


Result: <a href= ' test ' >Test</a>

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.