1
我哈瓦一個XML文件是這樣的:在xml文件中循環一個循環?
<name>
<entry>
<date>2012-03-18 13:53:23</date>
<ID>1</ID>
<category>questions</category>
<question>who are you?</question>
<answers>
<answer text='a man' id='1'/>
<answer text='a woman' id='2'/>
<answer text='an animal' id='3'/>
<answer text='an alien' id='4'/>
</answers>
<author>Gorge</author>
</entry>
</name>
我試圖以循環中的所有領域,但是當我得到答案點它dosent循環中的所有答案
任何提示我怎麼能管理呢?
我使用:
foreach($xml->entry as $entry){
echo "<p>";
echo "<strong>Author:</strong> ".$entry->author."<br/>";
echo "</p>";
}
爲了得到結果。
Thanx提前 帕特里克
你是如何循環的領域?在代碼中?使用XSLT? – 2012-03-24 09:47:30
在你的代碼中是否有'foreach($ entry-> answers-> answer作爲$ answer)? – Tomalak 2012-03-24 09:52:09