【发布时间】:2018-08-02 03:32:39
【问题描述】:
有谁知道我如何在 PHP 中循环这个 JSON 数组?我刚试了,还是不行
[{
//
"data": [{
"id": "1",
"name": "Tiger Nixon",
"position": "System Architect",
"salary": "$320,800",
"start_date": "2011/04/25",
"office": "Edinburgh",
"extn": "5421"
},
{
"id": "2",
"name": "Garrett Winters",
"position": "Accountant",
"salary": "$170,750",
"start_date": "2011/07/25",
"office": "Tokyo",
"extn": "8422"
},
{
"id": "3",
"name": "Ashton Cox",
"position": "Junior Technical Author",
"salary": "$86,000",
"start_date": "2009/01/12",
"office": "San Francisco",
"extn": "1562"
},
{
"id": "4",
"name": "Cedric Kelly",
"position": "Senior Javascript Developer",
"salary": "$433,060",
"start_date": "2012/03/29",
"office": "Edinburgh",
"extn": "6224"
}
]
}]
【问题讨论】:
-
这只是一个 JSON 数组。您如何尝试添加循环?在这里,我们希望您try to solve your own problem first,因为您的尝试有助于我们更好地了解您想要什么。请尝试一下,然后更新您的问题以显示您在minimal, complete, and verifiable example 中遇到的特定问题。欲了解更多信息,请参阅how to ask good questions,并拨打tour of the site。
-
你可以使用
foreach语句循环它 -
在
php你必须decodejson数据
标签: javascript php json