【发布时间】:2019-07-10 10:59:39
【问题描述】:
我有这样的 json:
{
data: [
{
_id: 6,
Logo: "http://s3-eu-west-1.amazonaws.com/korabia-eg/images/Logos/Leagues/6.png",
matches: [
{
matchId: 1393036,
competitionId: 6,
teamAId: 18299,
teamALogo: "http://www.datasportsgroup.com/images/clubs/50x50/18299.png",
teamBId: 733,
teamBLogo: "http://www.datasportsgroup.com/images/clubs/50x50/733.png",
scoreA: 2,
scoreB: 2,
status: "Played",
timing: "2019-02-15T17:00:00Z",
}
],
}
],
}
我需要使用 foreach 将此数据添加到 SQL 表中,
怎么办?
【问题讨论】:
-
欢迎来到 Stack Overflow。听起来您在这里有两个单独的问题,这两个问题都已在 SO 上得到广泛回答。请参阅:Parsing JSON with PHP、Insert into database with foreach。这里有更多示例,php.net/manual 有大量文档。做一些研究,尝试一些事情,当你遇到 minimal reproducible example 的特定编码问题时回来。