| This article describes how to use strip_tags () function in php. if you need it, refer. In php, the strip_tags () function can remove HTML, XML, and PHP labels. Usage: The allow following strip_tags (string, allow) is optional. If entered, the tag is allowed. Appendix. php uses strip_tags to clear all tags. String strip_tags (string str ); The strip_tags function removes any HTML and PHP tag strings contained in the string. If the HTML and PHP tags of a string are incorrect, for example, if a greater symbol is missing, an error is returned. String strip_tags (string str [, string allowable_tags]) returns a string to remove html tags. you can use the second parameter to set tags that do not need to be deleted. For example:
Question 1: How does strip_tags retain multiple HTML tags? You only need to separate multiple tags with spaces and write them to the second parameter of strip_tags. the code is as follows: strip_tags($str, " "); Question 2: How does php delete a specific tag in the html tag? Code:
2? Array_diff ($ args, array ($ text): (array) $ tags; foreach ($ tags as $ tag) {if (preg_match_all ('/<'. $ tag. '[^>] *> ([^ <] *)
/Iu ', $ text, $ found) {$ text = str_replace ($ found [0], $ found [1], $ text );}} return preg_replace ('/(<('. join ('|', $ tags ). ') (| .) */>)/iu ', '', $ text);} $ str =" [url = "] 123 [/url]"; echo strip_selected_tags ($ str, array ('B');?> |