我需要从我的内容中删除所有 html 元素。内容示例:
"<p><img alt=\"\" src=\"/ckeditor_assets/pictures/1/content_twitter-sink.jpg\" style=\"width: 570px; height: 399px;\" /></p>\r\n\r\n<h3 style=\"font-size: 1.38462em; margin: 1em 0px 0px; font-weight: 600; line-height: 1.2; font-family: freight-sans-pro, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizelegibility; color: rgb(46, 46, 46);\">Soraya Calavassy, communications manager at the Award in Australia, shares her organisation's experience piloting our new global visual identity.</h3>\r\n\r\n<p style=\"margin: 0.5em 0px 0px; text-rendering: optimizelegibility; font-size: 1.30769em; line-height: 1.3; color: rgb(78, 78, 78); font-family: freight-sans-pro, sans-serif;\">"While Australia has a very strong brand locally, there are some great benefits for incorporating"
显示帖子时,我使用 raw ,它确实给了我需要的输出。但我需要生成一个摘录。为此,我需要去除所有 HTML 标签,甚至删除图像。但是当我使用sanitize时 ,它不会删除图像。如果我使用strip_tags,它会删除图像,但会添加'
撇号、
空格等。那么,如何获得没有图像和
内容的干净摘录?