2
我想从JSON数组中获取特定变量,并且似乎无法得到它。有人可以请帮忙。PHP尝试从JSON字符串获取特定变量
这里是JSON
{
"associatedStoreIdentifiers": [
578661564
],
"associatedApps": [
{
"title": "Psbook",
"idGooglePlay": "com..app"
}
],
"locations": [
{
"longitude": -122.3748889,
"latitude": 37.6189722
},
{
"longitude": -122.03118,
"latitude": 37.33182
}
],
"barcode": {
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1",
"altText": "0497 6880 9072 8",
"message": "$1$PC$uWc8JwVNRbagWll2_RyDaw$idnV3v1jeVsL5g=="
},
"logoText": "",
"foregroundColor": "rgb(0,0,0)",
"backgroundColor": "rgb(255,255,255)",
"generic": {
"headerFields": [
{
"label": "Floor",
"value": "LEVEL 15",
"key": "Floor"
}
],
"primaryFields": [
{
"label": "Building",
"value": " Melbourne",
"key": "member"
}
],
"secondaryFields": [
{
"label": "Location",
"value": "FEMALE TOILET",
"key": "subtitle"
}
],
"auxiliaryFields": [],
"backFields": [
{
"key": "-poweredby",
"value": "Find out more and create your own passes at:\nhttp://www..com.au",
"label": "Powered by "
},
{
"key": "legalnotice",
"label": "Legal Notice",
"value": "This pass has been created by THE PASS ISSUER."
}
]
},
"serialNumber": "b9673c27-054d-45b6-a05a-5976fd1c836b",
"passTypeIdentifier": "pass.com",
"formatVersion": 1,
"description": "",
"organizationName": "Group",
"teamIdentifier": "34V8SZHXRM",
"authenticationToken": "f018753e-d059-49ca-ac2c-362a3de8cff3",
"webServiceURL": "https://pass.center/s",
"barcodes": [
{
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1",
"altText": "0497 6880 9072 8",
"message": "$1$PC$uWc8JwVNRbagWll2_RyDaw$idnV3v1jeVsL5g=="
}
]
}
,我试图让HeaderFields - 只是>值
我使用的线是
$level = $json->generic->headerFields->value
它 - >值和secondaryFields似乎不想玩游戏。
有人能让我知道我要去哪里吗?
感谢
嗨@bansi谢谢你。完美工作。 –