The phpstrip_tags () function removes the HTML, XML, and PHP tags from the string and returns the string after the tag is removed. However, when we need to retain multiple HTML tags, how can I use the phpstrip_tags () function? This article introduces how to use the phpstrip_tags () function to retain multiple HTML tags. let's take a look. The php strip_tags () function removes HTML, XML, and PHP tags from strings and returns the strings after the tags are removed. However, when we need to retain multiple HTML tags, how can I use the php strip_tags () function? This article introduces how to use
Php strip_tags () function to retain multiple HTML tagsLet's take a look.
Use the php strip_tags () function to retain multiple HTML tags. This mainly involves the second parameter of strip_tags. you can use the second parameter to set the tags that do not need to be deleted.
Usage
If there is such a string, the code is as follows:
$ Str ="I'm fromPHP Chinese network
";
No HTML tags are retained. the code is as follows:
I'm fromPHP Chinese network"; Echo strip_tags ($ str) ;?>
Code running output:I'm from PHP.
To keep only one tag, you only need to write the string to the second parameter of strip_tags. the code is as follows:
I'm fromPHP Chinese network"; Echo strip_tags ($ str," ");?>
Code running output:I'm from PHP.
To retain
And... Multiple tags, separated by spaces, must be written to the second parameter of strip_tags:
I'm fromPHP Chinese network"; Echo strip_tags ($ str ," ");?>
Code running output:
I'm fromPHP Chinese network
[Recommended related articles]
Detailed description of the strip_tags () function example for removing string tags from php
Notes for using the php strip_tags () function
The above describes how to use the php strip_tags () function to keep detailed details of multiple HTML tag instances. For more information, see other related articles in the first PHP community!