PHP implements code for deleting HTMl tags. Copy the code as follows: *** retrieve the html tag ** @ accesspublic * @ paramstringstr * @ returnstring ** functiondeletehtml ($ str) {$ strtrim ($ str); clear both sides of the string
The code is as follows:
/**
* Retrieve html tags
*
* @ Access public
* @ Param string str
* @ Return string
*
*/
Function deletehtml ($ str ){
$ Str = trim ($ str); // clear spaces on both sides of the string
$ Str = strip_tags ($ str ,"
"); // Clear the html format using the built-in functions of php. Keep P tag
$ Str = preg_replace ("/\ t/", "", $ str); // use a regular expression to match the content to be replaced, such as space, line feed, and will be replaced 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 spaces in html
Return trim ($ str); // return a string
}
The http://www.bkjia.com/PHPjc/327989.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327989.htmlTechArticle code is as follows:/*** retrieve the html tag ** @ access public * @ param string str * @ return string **/function deletehtml ($ str) {$ str = trim ($ str); // clear both sides of the string...