这是一个例子项目:问题的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