我可以用 $data->{'msg'} 印第一層的值,例如 msg但假設我要印第二層我要怎麼寫?比如說我要印 card_info 的 bin_code
{
"status": 0,
"msg": "Success",
"amount": 100,
"acquirer": "xxx",
"currency": "xxx",
"rec_trade_id": "xxx",
"bank_transaction_id": "xxx",
"order_number": "",
"auth_code": "xxx",
"card_info": {
"issuer": "JxxA",
"funding": 0,
"type": 1,
"level": "",
"country": "xx x",
"last_four": "x",
"bin_code": "x",
"country_code": "x"
},
"transaction_time_millis": 1531387581490,
"bank_transaction_time": {
"start_time_millis": "1531387581528",
"end_time_millis": "1531387581528"
},
"bank_result_code": "0",
"bank_result_msg": ""
}
他不是 array,所以我的方式完全不行==
1 回答
慕村225694
TA贡献1880条经验 获得超4个赞
你这个是json结构,解析成数组结构,再去获取。
$array = json_decode($json, true);
$bin_code = $array['card_info']['bin_code'];
- 1 回答
- 0 关注
- 336 浏览
添加回答
举报
0/150
提交
取消