【发布时间】:2015-11-26 22:08:59
【问题描述】:
我使用的 API 的端点结果如下所示:
[
{
placeId: 1,
startDateIso: "2015-11-26T12:00:00+0100",
},
{
placeId: 1,
startDateIso: "2015-11-26T13:00:00+0100",
},
{
placeId: 1,
startDateIso: "2015-11-27T10:00:00+0100",
},
{
placeId: 1,
startDateIso: "2015-11-27T11:00:00+0100",
},
]
我如何对这个 JSON 数组进行排序以获得这样的输出:
{
[
{
placeId: 1,
startDateIso: "2015-11-26T12:00:00+0100",
},
{
placeId: 1,
startDateIso: "2015-11-26T13:00:00+0100",
}
],
[
{
placeId: 1,
startDateIso: "2015-11-27T10:00:00+0100",
},
{
placeId: 1,
startDateIso: "2015-11-27T11:00:00+0100",
}
]
}
我想按日期对数据进行排序,并为每个数据创建一个数组。
【问题讨论】:
-
如何使用 API?您想在哪里以及如何进行排序?
-
如果您需要帮助,请显示您的代码 .. 仅需要的输出是不够的 ..
-
您想要的 JSON 输出也无效
标签: php arrays json sorting slim