我正在从Web服务接收下面的输出。 (图中的输出是通过var_dump(json_decode($json,true));
要从对象本人可以使用的后半部分获得的数据,例如:需要语法才能访问json对象中的数组
$obj = json_decode($json);
$myvalue=$obj->{'CurrentAccountNumber'};
但我还需要在对象的开始到得到来自阵列数据(通过PHP) ?什么是正确的语法使用使用PHP来获取/回波的阵列数据谢谢您从WEB SERVICE
OUTPUT:
阵列(30){[ “帐户”] =>阵列( 2){[0] => array(4){[“AccountNumber”] => string(9)“123456789”[“CurrentBalance”] => float(455.17)[“FullName”] => string(8) JOHN DOE“[”Code“) (3)“A34”} [1] => array(4){[“AccountNumber”] => string(9)“123456788”[“CurrentBalance”] => float(67.22)[“ FullName“] => string(8)”JOHN DOE“[”CodeNum“] => string(3)”B82“}}
如何从此行的数组中获取数据?
[ “CurrentAccountNumber”] =>串(9) “123456789”[ “CurrentBalance”] =>浮动(455.17)[ “CustomMonth”] => BOOL(真)[ “CustomMonthAmt”] =>浮(488.17)[“CustomMonthLength”] => int(0)[“DateOfService”] => string(10)“2013-06-15”[“十八月”] => bool(false)[“十八月月”] => int(0)[“ExpectedLastPaymentAmount”] => float(0)[“ExpectedLastPaymentDate”] => string(0)“”[“FullName”] => string(8)“JOHN DOE”[“Email”] => string(11)“myemail.com”[“LastFourPhone”] => string(4)“5128”[“LastPaymentAmount”] => float(4205.83)[“LastPaymentDate”] => string(10) [“NextPaymentAmount”] => float(0)[“NextPaymentDate”] => string(0)“”[“Category”] => int(0)[“InsPlanStartDate”] => string(10) “08-08”[“PrimaryPhoneNumber”] => string(10)“5555555128”[“SixMonth”] => bool(false)[“SixMonthAmt”] => int(0)[“CodeNum”] => strin g(3)“A34”[“TwelveMonth”] => bool(false)[“TwelveMonthAmt”] => int(0)[“TwentyFourMonth”] => bool(false)[“TwentyFourMonthAmt”] => int(0 )[ “UseInfoOnFile”] => BOOL(真)[ “邮编”] =>串(5) “12345”}
首先将你的json数据解码为一个数组,然后将其解码为一个对象。你也向我们展示了来自同一个变量的两个不同的数据输出。所以你在这里混合了一些东西。 – Rizier123
是的,json对象返回的是对象第一部分的数组和第二部分的字符串。谢谢您的回复。 – RWilliams