我如何从这个 json 创建一个将 ATTRIBUTE_TYPE 关联到 ATTRIBUTE ID 的数组。现在我被返回以下json:
(
[success] => 1
[ATTRIBUTES_COUNT] => 106
[ATTRIBUTES] => Array
(
[0] => Array
(
[ATTRIBUTE_TYPE] => email
[DATA_TYPE] => CHAR
[COMPARE_COUNT] => 2
[COMPARE] => Array
(
[0] => Array
(
[ATTRIBUTE_ID] => 4222
[DESCR] => Equals
)
[1] => Array
(
[ATTRIBUTE_ID] => 4223
[DESCR] => Not Equal
)
)
)
[1] => Array
(
[ATTRIBUTE_TYPE] => interest
[DATA_TYPE] => MONEY
[COMPARE_COUNT] => 7
[COMPARE] => Array
(
[0] => Array
(
[ATTRIBUTE_ID] => 4006
[COMPARE_DESCR] => Not Equal
)
[1] => Array
(
[ATTRIBUTE_ID] => 4000
[COMPARE_DESCR] => Equals
)
[2] => Array
(
[ATTRIBUTE_ID] => 4001
[COMPARE_DESCR] => Greater Than
)
)
)
)
现在我想创建一个数组,它会在 json_decode 之后返回如下内容:
{
"DETAILS": [
{
"ATTRIBUTE_ID": "4222",
"ATTRIBUTE_TYPE": "email",
},
{
"ATTRIBUTE_ID": "4006",
"ATTRIBUTE_TYPE": "interest",
}
]
}
同一个属性类型可以有多个属性ID。