1. Read the rich text content style from the database as follows:
<p style= "; text-indent:0;padding:0;line-height:26px" ><span style= "font-family: Microsoft ya black; Letter-spacing:0;font-size:14px ">&nbsp; &nbsp; This is a small test! This is a small test! This is a small test! This is a small test! This is a small test! </span></p><p style= "; text-indent:0;padding:0;line-height:26px" >& Lt;span style= "font-family: Microsoft Jas Black; letter-spacing:0;font-size:14px" >&nbsp; &nbsp; This is a small test! This is a small test! This is a small test! This is a small test! This is a small test! This is a small test! </span></p><p style= "text-indent:0px; padding:0px; line-height:26px; Text-align:center; " ><span style= "font-family: Microsoft Jas Black; letter-spacing:0;font-size:14px" ><
2. First, the pre-defined HTML entity "<" via PHP's htmlspecialchars_decode () function (less than) and ">" CONVERT (greater than) to a character, and then strip The HTML, XML, and PHP tags from the string with the Strip_tags () function to get the desired txt plain text content.
The implementation of the PHP core code is as follows:
$content _01 $data ["Content"]; // get Rich text content from a database $content _02 = Htmlspecialchars_decode ($content _01)// convert some pre-defined HTML entities to characters $ Contentsstrip_tags($content _02); // function Strips HTML, XML, and PHP tags from a string to get plain text content $con substr ($contents, 0,);//Returns the character of the first 300 string length in a string
Var_dump ($con);//Print output
Exit
PHP will be rich text editing content, remove style pictures, etc. only preserve txt text content