XML file stores image location then use SimpleXML
I just want to know if i'm doing this right. I put a markup for the i开发者_如何学Pythonmage location in my xml file. I read it using this statement for php.
foreach($xml->children() as $image)
{
echo "<img src=\"$image->image\"/>";
}
Is this fine?
if your xml file is like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<image>a.jpg</image>
<image>b.jpg </image>
<image>c.jpg </image>
<image>d.jpg </image>
you can use this code
<?php
$xml = simplexml_load_file("test.xml");
foreach($image->children() as $image)
{
echo "<img src=\"$image->image\"/>";
}
?>
精彩评论