How to deleted an element inside XML string?

后端 未结 2 849
夕颜
夕颜 2021-01-24 14:52

How can the </code> element be deleted inside this XML string?</p> <pre><code>$input= \'<items>dfd jdh flkdjf <title>My Test Title </title>> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5408099190056760" data-ad-slot="7305827575" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="fly-panel detail-box" id="flyReply"> <fieldset class="layui-elem-field layui-field-title" style="text-align: center;"> <legend>2条回答</legend> </fieldset> <ul class="jieda" id="jieda"> <li data-id="111" class="jieda-daan"> <a name="item-1111111111"></a> <div class="detail-about detail-about-reply"> <a class="fly-avatar" href=""> <img src="https://www.e-learn.cn/qa/data/avatar/000/00/00/small_000000041.jpg" alt=" 滥情空心 "> </a> <div class="fly-detail-user"> <a href="" class="fly-link"> <cite> 滥情空心</cite> </a> <span>(楼主)</span> </div> <div class="detail-hits"> <span>2021-01-24 15:30</span> </div> </div> <div class="detail-body jieda-body photos"> <p> <p>Simplexml </p> <pre><code>$str = '<items>1<title>lalala...'; $xml = simplexml_load_string($str); unset($xml->children()->title); $output = str_replace("\n", '', $xml->asXml());

提交回复
热议问题