Example of a string filter strip_tags () function in PHP

Source: Internet
Author: User

strip_tags-Remove HTML and PHP tags from a string, very important functions
(PHP 4, PHP 5, PHP 7)
string Strip_tags (String $str [, String $allowable _tags])
$str: Enter a string.
$allowable _tags: Optional, specifies a list of characters that are not removed.
role: Strip The HTML, XML, and PHP tags from the string.
return Value: Returns the string that was stripped.

<?php$str = ' <p><a href= "jinsanguo.com" title= "Golden three" ><b><i> I come from the Golden three countries </i></b> </a></p> '; Echo strip_tags ($STR);//Right-click the source code, output: I come from the three countries echo strip_tags ($STR, "<a>");//Right-click the source code, the output: <a href= "jinsanguo.com" title= "Golden three" > I came from the Golden three </a>echo strip_tags ($str, "<p> <b>");//Right-click on the source code, Output:<p><b> I come from </b></p>echo strip_tags ($str, "<p> <b> <a>") from the Golden Kingdoms, and/or right-click on the source code, Output: <p><a href= "jinsanguo.com" title= "Golden three" ><b> I come from the Golden three countries </b></a></p>?>


This article is from the "Golden Three" blog, please be sure to keep this source http://jinsanguo.blog.51cto.com/13363984/1972091

Example of a string filter strip_tags () function in PHP

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.