我正在接收来自数据库的数据,这些数据来自包含 JSON 的数组。我想按标题对重复的值进行分组,即 GROUP 是标题,BREED 是标题,NAME 是这个标题的描述,如下所示。
车辆(集团)
电动(品种)
奥迪 A3 Sportback
宝马i3
雪佛兰螺栓
克莱斯勒 Pacifica PHEV
福特聚变能源
现代 IONIQ Electric
梅赛德斯 GLE 550
福特
三菱/日产
自走式(BREED)
步兵战斗
装甲侦察
骑兵格斗
装甲人员
空中缆车
婴儿车
送货车
日产聆风
推土机
这是里面有 JSON 的数组,下面是获取信息的循环。
<?php
$array = array(
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "Infantry fighting."
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Audi A3 Sportback."
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "Armored reconnaissance"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "BMW i3"
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "Cavalry fighting"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Chevrolet Bolt"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Chrysler Pacifica PHEV."
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "Armored personnel"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Ford Fusion Energi."
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "aerial tramway"
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "baby carriage"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Hyundai IONIQ Electric."
}',
'{
"GROUP": "Vehicle",
"BREED": "Self-Propelled",
"NAME": "delivery truck"
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Mercedes GLE 550e."
}',
'{
"GROUP": "Vehicle",
"BREED": "Electric",
"NAME": "Ford F"
}',
注意 BREED 和 GROUP 一遍又一遍地重复,我怎样才能让它们看起来像顶级模型?
森林海
泛舟湖上清波郎朗