How does php get rid of Rich text Styles
This article will explain in detail how to remove the rich text style from php. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
1. Open the corresponding file in the project.
2. Remove all Html tag spaces through the "function cutstr_html () {...}" method.
3. Call the "cutstr_html" method to remove the text style.
Example
/ * * remove all Html tags, spaces and whitespace, and intercept the string (including Chinese) * @ param string $string string * @ param number $sublength string length * @ param string $encoding encoding * @ param string $ellipsis ellipsis * / function cutstr_html ($string,$sublength,$encoding = 'utf-8',$ellipsis =' …') {$string = strip_tags ($string); $string = trim ($string); $string = mb_ereg_replace ("\ t", "", $string); $string = mb_ereg_replace ("\ r\ n", "", $string); $string = mb_ereg_replace ("\ r", "", $string); $string = mb_ereg_replace ("\ n", "", $string); $string = mb_ereg_replace ("", ", $string) If (mb_strlen (trim ($string), 'utf-8') < $sublength) {return trim ($string). $ellipsis;} else {return mb_strcut (trim ($string)). $ellipsis;}} / / Test string $str=' fherfhewkolfjlkdsjfld'; / call method Test echo cutstr_html ($string=$str,$sublength=5,$encoding='utf-8',$ellipsis='...') This is the end of the article on "how to get rid of rich text styles in php". I hope the above content can be of some help to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.