Maison >développement back-end >tutoriel php > php生成xml小疑点一个,不懂,
php生成xml小问题一个,不懂,在线等!
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php $xml_str = <<<eof <?xml version='1.0'?> <books> <book> <title>Harry Potter</title> <publisher>Warner Bros.</publisher> <price>39.0</price> </book> </books> eof; $dom = new DOMDocument; $dom->loadXML($xml_str); echo $dom->saveXML(); $dom->save("0000.xml"); ?>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?xml version="1.0"?> <books> <book> <title>Harry Potter</title> <publisher>Warner Bros.</publisher> [color=#FF0000]<price></price>[/color] </book> </books>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?xml version="1.0"?> <books> <book> <title>Harry Potter</title> <publisher>Warner Bros.</publisher> [color=#FF0000]<price></price>[/color] </book> </books>