A bug analysis of PHP function strip_tags _php Tutorial

Source: Internet
Author: User
PHP function Strip_tags provides the ability to remove HTML and PHP tags from a string, which attempts to return the result of the given string str after removing null characters, HTML, and PHP tags.

Because Strip_tags () cannot actually validate HTML, incomplete or broken labels will result in more data being deleted.

For example, the following code:

Copy the Code code as follows:
Stringstring <> hellostring

Filtering by Strip_tags ($str, '), we may expect to get the following result:

Copy the Code code as follows:
Stringstring<>

The actual operation results are as follows:

Copy the Code code as follows:
Stringstring

It's all because of the left angle bracket of accents, checked the PHP documentation, there is a warning prompt:

Because Strip_tags () cannot actually validate HTML, incomplete or broken labels will result in more data being deleted.

Since the code correctness cannot be verified before the filter is executed, the code that follows the character "<" or ">" that is associated with the tag is all hung up!

http://www.bkjia.com/PHPjc/774996.html www.bkjia.com true http://www.bkjia.com/PHPjc/774996.html techarticle PHP function Strip_tags provides the ability to remove HTML and PHP tags from a string, which attempts to return the result of the given string str after removing null characters, HTML, and PHP tags. ...

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