PHP HTML markup To remove the original function of the details, PHP markup functions in detail _php tutorial

Source: Internet
Author: User

PHP HTML markup To remove the original function of the explanation, PHP tag function in detail


Strip_tags removes HTML and PHP markup. Syntax: string strip_tags (String str); Return value: String function type: Data processing content Description This function removes any HTML and PHP tag strings contained in the string. If the string of HTML and PHP tag is wrong, for example, less than the symbol, it will also return the wrong

Strip_tags

Remove the HTML and PHP tags.

Syntax: string strip_tags (String str);

return value: String

Function type: Data processing

Content Description

This function removes any HTML and PHP tag strings contained in the string. If the string of HTML and PHP tags are wrong, for example, less than the symbol, it will also return errors. The function and FGETSS () have the same functions.

Htmlspecialchars

Converts special characters to HTML format.

Syntax: String htmlspecialchars (String string);

return value: String

Function type: Data processing

This function converts special characters to HTML string format (&....;). The most commonly used occasion may be to deal with the message of the customer message version.

& (and) turn into &
"(double quotation marks) to turn"
< (less than) turn into <
> (greater than) turn into >
This function converts only the above special characters, and does not convert all of the ASCII conversions that are determined by the HTML.

usage Examples

Copy the Code code as follows:
<?php
$new = Htmlspecialchars ("Test", ent_quotes);
Echo $new;
?>

Attach an example of an application in my project:

When the database is stored in the MySQL database will escape the special symbol, then we will be escaped when reading, and I need to n_info the project to remove the HTML tag, and then intercept 60 characters to display the content

This thought that the direct use of strip_tags () can be achieved, the actual use of the time only found because the database content is escaped, strip_tags is not recognized, so you need to first escape the special characters back,

Specific code: _SUBSTR (Strip_tags (Htmlspecialchars_decode ($value [' N_info '])), 0, 60)

http://www.bkjia.com/PHPjc/948409.html www.bkjia.com true http://www.bkjia.com/PHPjc/948409.html techarticle PHP HTML Markup To remove the original function of the details, PHP tag function in detail strip_tags remove HTML and PHP markup. Syntax: string strip_tags (String str); Return value: String function type: Capital ...

  • Related Article

    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.