简体   繁体   中英

How to save a neatly formatted XML file using Simple XML?

What's the "trick" to save an XML file that visually would result neatly formatted?

such as:

<xml>
   <item>foo</item>
</xml>

and not:

<xml><item>foo</item></xml>

如果Xml的正确格式对您而言非常重要而不是SimpleXml,请使用具有以下属性的DOM (也包括且更复杂)扩展:

$xml->formatOutput = true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM