php 生成 修改 删除XML文件
<?php$doc=new DOMDocument();$doc->load('root.xml');$root=$doc->documentElement;$books=$doc->getElementsByTagName('php100');foreach ($books as $book){if ($book->getAttribute('id')==3){echo $book->getAttribute('id');echo $book->getElementsByTagName("index")->item(0)->nodeValue="change";//赋值修改XML}if ($book->getAttribute('id')==1){$root->removeChild($book);//删除XML}}$doc->save('root.xml');?>