[請益] 請問關於 XML的使用
假如今天 XML 的資料型態是
<typeA id=A0>
<typeB>
<amount1>001</amount1>
<amount2>002</amount2>
<amount3>003</amount3>
</typeB>
</typeA>
<typeA id=A1>
<typeB>
<amount1>101</amount1>
<amount2>102</amount2>
<amount3>103</amount3>
</typeB>
<typeB>
<amount1>111</amount1>
<amount2>112</amount2>
<amount3>113</amount3>
</typeB>
</typeA>
今天我想直接抓 typeA id=A1 的資料要怎麼抓???
以前我寫 flash時
是用 xml.typeA.(@id=='A1').typeB
不過 php不能這樣寫
請問我要如何才能直接抓到 A1 的資料????
另外還有 Array使用的問題
因為 typeB 的資料 在 typeA 中可能是多筆 也可能是單筆
如果我用 Array 來統一處理 typeB
結果 A0 單筆 typeB 會變成在 Array amount1,amount2,amount3
而不是在 Array typeB
但我希望他 Array typeB 就好了 不要Array到內部的資料
不過就算我先把 typeB 判斷 is_array 也是會過 擋不住
想請大家給些意見
謝謝了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.126.69
推
03/30 20:40, , 1F
03/30 20:40, 1F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章