這是一個例子項目:問題的SimpleXML解析WoWArmory屬性
SimpleXMLElement Object
(
[@attributes] => Array
(
[displayInfoId] => 62116
[durability] => 100
[gem0Id] => 41401
[gem1Id] => 4
[gem2Id] => 0
[gemIcon0] => inv_jewelcrafting_shadowspirit_02
[gemIcon1] => inv_jewelcrafting_gem_37
[icon] => inv_helmet_98
[id] => 48592
[level] => 245
[maxDurability] => 100
[name] => Liadrin's Headpiece of Triumph
[permanentEnchantIcon] => ability_warrior_shieldmastery
[permanentEnchantItemId] => 44876
[permanentenchant] => 3819
[pickUp] => PickUpLargeChain
[putDown] => PutDownLArgeChain
[randomPropertiesId] => 0
[rarity] => 4
[seed] => 0
[slot] => 0
)
)
我試圖讓每個項目一個JSON對象,但有大約17什麼的,如果我嘗試json_encode()
它給我「@attributes」作爲包含我想要的所有東西的對象。幫幫我?
對不起,我有點困惑,如果這是php代碼,那麼逗號分隔鍵 - 值對的地方在哪裏?和終結者分號?你從哪裏得到這個? – 2010-11-03 00:11:56
@Michael看起來像SimpleXML對象的'print_r' – Phil 2010-11-03 00:13:14
是的,我試圖從SimpleXML對象獲取JSON對象。 – 2010-11-03 00:14:40