我想通过调用 id 100 来删除整个贴纸节点。但实际上什么也没发生。任何的想法 ?
$xml = new DOMDocument();
$xml->load('../write.xml');
$result = $xpath->query('/stickers/sticker[id="100"]');
$result->childNodes->item(0)->parentNode->removeChild($result->childNodes->item(0));
$xml->save('../write.xml');
<stickers>
<sticker> /* Remove */
<text>Thaishi1</text>
<id>100</id>
</sticker>
<sticker>
</position>
<text>Thaishi2</text>
<id>200</id>
</sticker>
</stickers>