Asxml (' file.xml ') saved files after disposing of XML in SimpleXML, no format layout? One line looks at the Heavenly book.

Source: Internet
Author: User
Tags addchild
Asxml (' file.xml ') saved files after processing XML in SimpleXML, no format layout? One line looks at the Bible.
Build an XML file in SimpleXML,

Xml->addchild ()

Xml->addattribute ()
The Horse of God,

Save time Xml->asxml (' file.xml '); The resulting XML file is displayed on one line,

Look and want to be crazy, too disorderly pull.

Can't he just wrap it up and indent it?

Share to:


------Solution--------------------
It seems that there is no ... Only manual substitution plus line break is available:
------Solution--------------------
Add one sentence: $xml->formatoutput = true;
------Solution--------------------
Read the manual tidy module
------Solution--------------------
Wrapping, indenting is meaningless for XML, just adding the size of the XML document in vain (it's already big enough)
What you see in any XML editor (including your browser) is formatted content

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.