PHP - Read file in folder and subfolders and export to XML file

cibleBailaVep

New Member
I get this\[quote\] XML Parsing Error: junk after document element Location: xxxxxxxxx Line Number 2, Column 1\[/quote\]This is the code :\[code\]<?php$xml_generator = new SimpleXMLElement('<data/>');filesindir('assets/images/');function filesindir($dirs) { $dirs = scandir($tdir); while ($file = readdir($dirs)) { if (($file == '.')||($file == '..')) { } elseif (is_dir($tdir.'/'.$file)) { filesInDir($tdir.'/'.$file); } else { $image = $xml_generator->addChild('image'); $image->addChild('name', $file); } }}header("Content-Type: text/xml");$xml_generator->asXML('data.xml');echo $xml_generator->asXML();?>\[/code\]What did I do wrong?
 
Back
Top