我一直在尝试创建一个foreach
循环,该循环ListingId
将从 XML 文件中获取所有内容,但由于某种原因,我只能获取一个“Id”
XML结构:
<List>
<Listing>
<ListingId></ListingId>
</Listing>
<Listing>
<ListingId></ListingId>
</Listing>
<Listing>
<ListingId></ListingId>
</Listing>
</List>
PHP:
$xml = simplexml_load_file("domain.co.nz/xml.xml");
foreach($xml->List->Listing->ListingId as $value)
{
$xmlArray[] = $value;
}