Outsourcing Development Company : AmongChina IT Co.,Ltd

A little tip for php-xml-dom

August 20, 2009 by admin
Filed under: Web Programming 

Today,I tried to create a xml file by php, I used dom to create the xml file,but I found that the application can output xml file,but can not made it in correct and expect format.

I searched by google,but little useful points,I tried something,I found one easy and good tip,
Some codes are as follows:

header(’Content-Type:text/xml’);
$guestbook = new DomDocument();
$guestbook->formatOutput = true;

the bold codes are the main point,pls note it.

Hope it can helpe some one who met this problem.

Try it!

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!