This article introduces how to delete html tags in php and the two examples of html tags in strings. For more information, see. 1. the example of deleting html tags uses the php string processing function strip_tags.
"); // Clear the html format using the built-in functions of php. Keep the P tag $ str = preg_replace ("/\ t/", "", $ str); // use the regular expression to match the content to be replaced, such as space, line feed, and replace with null. $ Str = preg_replace ("/\ r \ n/", "", $ str); $ str = preg_replace ("/\ r/", "", $ str ); $ str = preg_replace ("/\ n/", "", $ str); $ str = preg_replace ("//", "", $ str ); $ str = preg_replace ("//", "", $ str); // matches the space return trim ($ str) in html ); // returns a string} // by bbs.it-home.org?> 2. the Function for deleting HTML tags in a string sometimes disables html tags when content is submitted on the page. the following functions can implement this function:
")$i++;$i++;}$str=$str.substr($scr,$i,1);}return($str);}?> Articles you may be interested in: php: two ways to remove HTML tags php: remove excessive HTML tags php uses strip_tags to completely remove all html tags example of how php filters html tags using strip_tags) php: Three ways to delete html tags sharing: differences between strip_tags and htmlspecialchars for removing html tags in php: functions for deleting html tags in a string removing html tag code in the content extracting php code for html tags php code example for regular expression filtering of html tags, spaces, line breaks, etc. php removes html tags to obtain the code for the input plain text document strip_tagsphp to enable HTML tags to automatically complete closed functions. php implements html tag auto-completion code how to use thinkPHP Html template tags |