2012-08-09 165 views
-1

我怎麼能得到這個用我的代碼從這個XML:簡單的XML解析attirubute

<lfm status="ok"><results for="sub bass monster ragga"> 
<opensearch:Query role="request" searchTerms="sub bass monster ragga" startPage="1"/> <opensearch:totalResults>2</opensearch:totalResults><opensearch:startIndex>0</opensearch:startIndex><opensearch:itemsPerPage>30</opensearch:itemsPerPage><trackmatches> 

$count = $xml->results[0]->opensearch:totalResults ??? 
+0

'SimpleXMLElement :: children()'也許有幫助,但請張貼您的完整或至少格式良好的XML,包括'opensearch'的名稱空間定義。 – 2012-08-10 17:32:27

回答