PHP converts rich text data into text, rich text clear tags

Some data is rich text data, including some tags, using the following method is very simple to get the plain text content. 

/* 
 * Function description: convert rich text data into text 
 * @access public 
 * @param $content string rich text data 
 * @return string text without label 
 */ 
public function test($content =''){ 
    $data1 = htmlspecialchars_decode($content);//Convert some predefined HTML entities into characters 
    $data2 = strip_tags($data1);//Remove the HTML, XML, and PHP tags in the string to get the plain text content 
    return $data2 ; 
}

Guess you like

Origin blog.csdn.net/u010991531/article/details/114309835