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