2012-04-30 46 views
0

我在php中使用了print_r()。PHP中的simplexml解析

SimpleXMLElement Object 
(
    [@attributes] => Array 
     (
      [term] => hello world 
      [scheme] => Organization 
     ) 
) 

如何使用php simplexml訪問方案節點?我有麻煩,因爲@符號

回答

2

你會使用數組符號這樣的訪問屬性的節點@屬性工作:

$scheme = $obj['scheme']; 

Basic SimpleXML Usage從PHP手冊頁。它顯示了訪問屬性以及其他內容。