cle*_*tus 14
当然可以使用SimpleXML进行编辑:
$input = <<<END
<?xml version='1.0' standalone='yes'?>
<documents>
<document>
<name>spec.doc</name>
</document>
</documents>
END;
$xml = new SimpleXMLElement($input);
$xml->document[0]->name = 'spec.pdf';
$output = $xml->asXML();
Run Code Online (Sandbox Code Playgroud)
看看这些例子.
使用SimpleXML加载XML并进行更改.然后,您可以使用asXML方法将XML保存到文件中(将文件名作为参数传递):
$xml = new SimpleXMLElement( $xmlString );
// do the manipulation here
$xml->asXML ( '/path/to/your/file.xml' );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22124 次 |
| 最近记录: |