PHP cannot read data in XML via SimpleXML ... Pure rookie study, less pat me ha.
A product.xml document with the following content: (Similar item entry has multiple)
Product1
Images/product.jpg
Discription...discription ...
The content of the PHP document that invokes the data is
<title>Untitled Document</title>
$xml =simplexml_load_file ("Products.xml");
$part = $xml->product->item;
$k = 0;
while ($k <12) {
echo "
-
". $part [$k]->name.]
-
link. "' target= ' _blank ' >picurl. ' alt= '". $part [$k]->name. ' />
-
". $part [$k]->discription.]
";
$k + +;
}
?>
The result is called, and the output HTML statements are all right. But there is no data in the XML document tag.
Request for ENLIGHTEN!!!!! Appreciate ~~~~~ps: I am a pure rookie, the table excessively despise me ...
------Solution--------------------
$part = $xml->product->item;
should be for
$part = $xml->item;
That is, the root node is not in the Access column
This you can observe by Print_r ($xml)