0
我通過加載XML
文件simplexml_load_file
PHP:獲取XML的孩子沒有父母
XML:
<list>
<top>
<test>
<id>1</id>
</test>
<test>
<id>2</id>
</test>
<test>
<id>3</id>
</test>
</top>
<test>
<id>4</id>
</test>
</list>
我想一個foreach
我沒有得到所有TEST
標籤使用top
親代獲得test
chilren
我怎麼能?
PHP的文檔http://php.net/manual/en/simplexmlelement.children.php有你想要做一個例子 – bumperbox
本例使用3的foreach –