コンテンツからすべての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タグを削除し、画像を削除する必要があります。しかし、サニタイズを使用 すると、画像が削除されません。strip_tagsを使用すると、画像は削除されますが'
、アポストロフィや
スペースなどが追加されます。では、画像やコンテンツを含まないクリーンな抜粋を取得するにはどうすればよい
でしょうか。