在PHP中,我使用下面的代碼在我的網站頂部放置了一條橫幅。爲什麼這個XML屬性顯示兩次
$eventinfo = simplexml_load_file("eventinfo.xml");
<div id="eventinfo"><?php foreach($eventinfo->children() as $child){ $final = $child["name"]."...<a href='".$child["adr"]."'>more info...</a>"; } ?>
</div>
的XML文檔可在以下幾點:http://eastsidespeedway.raceresults.co/eventinfo.xml
如果你去http://eastsidespeedway.raceresults.co/index.php你會看到更多的信息...鏈接顯示兩次了。一個鏈接正確,另一個鏈接到同一頁面(index.php)。
任何人都可以闡明我做錯了什麼?
另外。如果你看到我做錯了什麼,或者你知道某件事更容易 - 讓我知道!這是我第一次使用XML/PHP,所以我只是在說它。哈哈。
一個人去test.html,另一個去index.php。測試場景中'adr'的價值是什麼? – adaam
adr的價值目前是www.eastsidespeedway.com/dirt.html(更多信息...鏈接)。查看XML Doc的eastsidespeedway.raceresults.co/eventinfo.xml。 –