HTML Go Tag

Source: Internet
Author: User

Method 1:
Directly remove the mark you want to remove


<?php
Remove BR Mark
function strip ($STR)
{
$str =str_replace ("<br>", "", $str);
$str =htmlspecialchars ($STR);
Return Strip_tags ($STR);
}
?>


Method 2.
PHP has a strip_tags function that makes it easy to remove HTML tags.
Echo strip_tags ("Hello <b>World</b>"); Remove HTML, XML, and PHP tags.
For non-standard HTML code can also be correctly removed:
Echo strip_tags ("<a href=\" >\ ">cftea</a>"); Output Cftea
In PHP, you can use the Strip_tags function to remove HTML tags, as shown in the following example:

Copy CodeThe code is as follows:
<?php
$str = ' www<p>dreamdu</p>.com ';
Echo (Htmlspecialchars ($STR). <br> ");
Echo (Strip_tags ($STR));
?>


Method 3.
The STRTR () function converts a specific character in a string.
Grammar
STRTR (String,from,to)
Or
STRTR (String,array)

Parameters Description
String1 Necessary. Specifies the string to convert.
From Required (unless an array is used). Specifies the character to be changed.
To Required (unless an array is used). Specifies the character to change to.
Array Required (unless using from and to). An array in which the key is the original character and the value is the target character.


Example 1:

Copy CodeThe code is as follows:
<?php
Echo strtr ("Hilla Warld", "ia", "eo");
?>


Example 2:

Copy CodeThe code is as follows:
<?php
$arr = Array ("Hello" = "Hi", "World" = "Earth");
Echo strtr ("Hello World", $arr);
?>

HTML Go Tag

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.