我有一个 xml 文件,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<prod id="1">
<layer id="layer_0" imgSRC="data/361_layer_0.png"/>
<layer id="layer_1" imgSRC="data/362_layer_0.png"/>
<layer id="layer_2" imgSRC="data/363_layer_0.png"/>
</prod>
<prod id="2">
<layer id="layer_0" imgSRC="data/361_layer_0.png"/>
<layer id="layer_1" imgSRC="data/362_layer_0.png"/>
<layer id="layer_2" imgSRC="data/363_layer_0.png"/>
</prod>
</data>
如何使用 simplexml 将项目插入到图层 id="layer_3" 中,如下例所示:
<prod id="1">
<layer id="layer_0" imgSRC="data/361_layer_0.png"/>
<layer id="layer_1" imgSRC="data/362_layer_0.png"/>
<layer id="layer_2" imgSRC="data/363_layer_0.png"/>
<layer id="layer_3" imgSRC="data/364_layer_0.png"/>
</prod>
我需要做什么?谢谢!!