1数组合并请问下怎么实现呢?谢谢了!
array(3) {
[0] => array(7) {
["game_name"] => string(18) "趣看每日一笑"
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
["id"] => int(1)
["gift_name"] => string(15) "进阶大礼包"
["gift_details"] => string(23) "金币*5000 砖石*100"
["need_score"] => int(30)
["gift_type"] => int(2)
}
[1] => array(7) {
["game_name"] => string(18) "趣看每日一笑"
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
["id"] => int(2)
["gift_name"] => string(15) "高阶大礼包"
["gift_details"] => string(25) "金币*50000 砖石*1000"
["need_score"] => int(120)
["gift_type"] => int(2)
}
[2] => array(7) {
["game_name"] => string(18) "趣看热点事件"
["game_icon"] => string(32) "game_icon_wx945daf05d01dad39.png"
["id"] => int(3)
["gift_name"] => string(12) "初级礼包"
["gift_details"] => string(8) "红包*1"
["need_score"] => int(50)
["gift_type"] => int(1)
}
}
修改为 :
array(3) {
[0] => array(7) {
["game_name"] => string(18) "趣看每日一笑"
["game_icon"] => string(32) "game_icon_wx0913c2de2ce8376a.png"
['gift']=>array(2){
[0]=>array(5){
["id"] => int(1)
["gift_name"] => string(15) "进阶大礼包"
["gift_details"] => string(23) "金币*5000 砖石*100"
["need_score"] => int(30)
["gift_type"] => int(2)
}
[1]=>array(5){
["id"] => int(2)
["gift_name"] => string(15) "高阶大礼包"
["gift_details"] => string(25) "金币*50000 砖石*1000"
["need_score"] => int(120)
["gift_type"] => int(2)
}
}
}
[2] => array(7) {
["game_name"] => string(18) "趣看热点事件"
["game_icon"] => string(32) "game_icon_wx945daf05d01dad39.png"
['gift']=>array(2){
[0]=>array(){
["id"] => int(3)
["gift_name"] => string(12) "初级礼包"
["gift_details"] => string(8) "红包*1"
["need_score"] => int(50)
["gift_type"] => int(1)
}
}
}
}
数组代码,我也懒得写了。给个JSON 数组吧!方便装换测试
[
{
"game_name": "趣看每日一笑",
"game_icon": "game_icon_wx0913c2de2ce8376a.png",
"id": 1,
"gift_name": "进阶大礼包",
"gift_details": "金币*5000 砖石*100",
"need_score": 30,
"gift_type": 2
},
{
"game_name": "趣看每日一笑",
"game_icon": "game_icon_wx0913c2de2ce8376a.png",
"id": 2,
"gift_name": "高阶大礼包",
"gift_details": "金币*50000 砖石*1000",
"need_score": 120,
"gift_type": 2
},
{
"game_name": "趣看热点事件",
"game_icon": "game_icon_wx945daf05d01dad39.png",
"id": 3,
"gift_name": "初级礼包",
"gift_details": "红包*1",
"need_score": 50,
"gift_type": 1
}
]
2 回答
- 2 回答
- 0 关注
- 437 浏览
添加回答
举报
0/150
提交
取消