我的JSON中有数组,如下所示:
[
{
"id":"bobbys_burgers",
"is_enabled":true,
"name":"Bobbys Burgers",
"supported_transactions":[
"222",
"111",
"333"
],
"enrollment_required":[
],
"restricted_transactions":[
"123"
]
},
{
"id":"randys_sandwich",
"is_enabled":true,
"name":"Randys Sandwich",
"supported_transactions":[
"321"
],
"enrollment_required":[
],
"restricted_transactions":[
]
},
]
我希望得到整个数组的所有键id
= randys_sandwich
。例如,我想搜索id
== randys_sandwich
并返回is_enabled
,name
,supported_transactions
等来自该数组的值。我怎么能在PHP中做到这一点?
答案 0 :(得分:-1)
你需要对你的数组进行json_decode然后循环遍历数组中的对象,找到你正在寻找的id。
RecyclerView