【发布时间】:2014-10-27 10:33:54
【问题描述】:
我有一个数组,我要输出到一个 json 中,它看起来像这样:
{
id: 207
order_id: 9325
other_id: 3332
}
{
id: 207
order_id: 4444
other_id: 33233
}
{
id: 437
order_id: 9325
other_id: 22233
}
如果 id 相同,我希望它看起来像这样:
id: 207
{
order_id: 9325
other_id: 3332
},
{
order_id: 4444
other_id: 33233
}
等等。
到目前为止,我输出 json 的后端代码如下所示:
foreach($others as $other)
{
if(!empty($other->table_one))
{
continue;
}
else
{
$checks[] = array('id' => $other->id, 'order_id' => $other->order_id, 'other_id' => $other->other_id);
}
}
【问题讨论】:
标签: php json angularjs laravel