PHP strip_tags () function to remove HTML, XML, and PHP tags from a string, strip_tagsxml_php tutorial

Source: Internet
Author: User

PHP strip_tags () goes to the function of HTML, XML, and PHP tags in the string, Strip_tagsxml


Strip_tags Definition and usage

The Strip_tags () function strips the HTML, XML, and PHP tags from the string.

Note: This function always strips HTML comments. This cannot be changed by the Allow parameter.

Note: This function is binary safe.

Grammar
Strip_tags (String,allow)

Parameters Description
String Necessary. Specifies the string to check.
Allow Optional. Specifies the allowable label. These tags are not deleted.

Technical details

return value: Returns the string that was stripped.
PHP version: 4 +
Update log:

Since PHP 5.0, this function is binary safe.

from PHP 4.3, the function will always strip HTML comments.

strip_tags Example 1,

Peel the HTML tags from the string:

world!");? >

Results

Hello world! 、

Example 2

Strip the HTML tags from the string, but allow labels to be used :

world!"," ");? >

Results

Hello world!

http://www.bkjia.com/PHPjc/1133113.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133113.html techarticle php strip_tags () goes to the functions of HTML, XML, and PHP tags in strings, strip_tagsxml strip_tags definition and Usage strip_tags () function to strip the HTML, XML, and PHP from the string. .

  • 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.