我的代码:
$writer = new XMLWriter();
$writer->openURI('data.xml');
$writer->startDocument('1.0','UTF-8');
$writer->startElement("cont");
$writer->writeElement('product', $produto);
$writer->writeElement('price', $preco);
$writer->endDocument();
$writer->flush();
输出:
Product: CD
Price: 10,00
如何在不删除最后一个元素的情况下添加元素?
我希望这个xml返回。
Product: CD2
Price: 20,00
Product: CD
Price: 10,00
Product...