2011-09-07 55 views

回答

3

前置使用的屬性和對象語法數組語法子節點:

$xml->foo['id'] // get `id` attribute on `foo` node 

Using attributes例子在這裏:http://docs.php.net/manual/en/simplexml.examples-basic.php#example-4741

另請參閱attributes()方法。

+0

但是$ node ['id]給了我一個包含具有該值的數組的對象,而不是值:|有沒有更快的方法來做到這一點? – Vera

+0

你可以用'(字符串)$ node ['id']騙取並將其轉換爲字符串' – helloandre

+0

tx我被騙了:D – Vera