Я создаю xml-файл, который вытащит описание продукта (opencart). Проблема в том, что он отображает весь html внутри описания. Я хочу, чтобы получить простой текст без каких-либо HTML-теги, дивы, стили и т.д.Получить текст из строки html
Например жала выводит ниже HTML в XML
<p><span style="font-weight: bold; font-family: Arial; color: rgb(0, 0, 0); font-size: 18px; font-style: italic;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">diam nonummy nibh euismod tincidunt ut laoreet dolore magna.</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">aliquam erat volutpat. Ut wisi enim ad minim veniam, quis</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip </span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip.</span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;"> nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip.</span><span style="color: rgb(0, 0, 0); font-family: Arial; font-size: 14px;">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></p>
<p><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);"> </span></p>
<p><span style="font-family: Arial; color: rgb(0, 0, 0); font-size: 18px; font-weight: bold;">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></p>
<ul>
\t <li><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></li>
\t <li><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></li>
\t <li><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></li>
\t <li><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></li>
\t <li><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></li>
</ul>
<p><em><strong><span style="font-family: Arial; font-size: 14px; color: rgb(0, 0, 0);">nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip</span></strong></em></p>
<p><span style="font-family: Arial;"> </span></p>
<p> </p>
на $ продукта [ 'description'], и я хочу оставить только описание без тэгов html.
Я попытался
$ ProdDescr = strip_tags (html_entity_decode ($ произведение [ 'описание'], ENT_QUOTES, 'UTF-8'));
, но это дает мне ошибки в XML
Я также попытался
$ ProdDescr = strip_tags ($ продукта [ 'описание']; EHCO $ ProdDescr;
а также не повезло
Можете ли вы рассказать мне, как сохранить только те xt строки? Thanks