Reputation: 573
I wish to create a list of XML files in a php file.
I need all my xml files to be included in my php file. I have this working see below.
<?php
header('Content-type: application/xml');
echo file_get_contents("exam1.xml");
when I try this it works well, now I try more than one.
<?php
header('Content-type: application/xml');
echo file_get_contents("exam1.xml");
echo file_get_contents("exam2.xml");
it dose not read any of the files.
Upvotes: 0
Views: 221
Reputation: 94672
I would try passing these files back in a JSON object.
Create an array of files and then json_encode()
that array.
<?php
$f1 = file_get_contents("exam1.xml");
$f2 = file_get_contents("exam2.xml");
$response = array('files' => array($f1, $f2));
echo json_encode($response);
?>
Now you will have a simple json object that you can process in the javascript and place 1 or many xml file(s) whereever you want to on the page using straight forward javascript
Upvotes: 2