我正在尝试解析PHP中的JSON对象。我的努力最终导致了这个var_dump的出现:
string(5) "Malta"
string(2) "mt"
string(11) "St Julian's"
string(5) "Malta"
string(2) "mt"
string(11) "St Julian's"
现在,我要打印的是“马耳他”。尝试的所有努力都失败了,我需要暗示下一步的工作。关于我该如何做的任何想法?谢谢
尝试解析此部分:“位置”:
{
"totalFound":2,
"content":[
{
"id":"a1d17bwqeqewqeqweaf-1e54-4861-92e1-8246baba11d6",
"title":"Developer",
"refNumber":"REFqweqwe4N",
"createdOn":"2015-08-28T11:10:07.000Z",
"updatedOn":"2015-08-28T13:19:59.000Z",
"location":{
"country":"Malta",
"countryCode":"mt",
"city":"St Julian's"
},
"status":"SOURCING",
"actions":{
"details":{
"url":"www.google.com",
"method":"GET"
}
}
}
],
"offset":0,
"limit":10
}
我的代码段:
$jfo = json_decode($data, TRUE);
foreach ($jfo['content'] as $category) {
if (isset($category['title']) != null) {
}
if (isset($category['location']) != null) {
foreach ($category['location'] as $location){
var_dump($location);
print_r($location);
尝试回显$category['location']['country']
删除那里的每个人的联系,以循环您的位置数组
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句