RickyC
2022-01-18 13:16:25 +08:00
```
function text_from_html($html)
{
// Remove the HTML tags
$html = strip_tags($html);
// Convert HTML entities to single characters
$html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
$html_len = mb_strlen($html, 'UTF-8');
// Make the string the desired number of characters
// Note that substr is not good as it counts by bytes and not characters
$html = mb_substr($html, 0, strlen($html), 'UTF-8');
return $html;
}
$content = htmlentities(text_from_html($content));
```
-----
提取出来可以试试这个。再放回去太难了。