我有这个JSON响应。但我无法通过PHP解析数据。 例如如果我想得到@ id.how。我可以做吗?我尝试过这行代码,却无法得到任何东西
$json = json_decode($jsonData,true);
echo $json['expose.expose'][0]['@id'];
{
"expose.expose": {
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798",
"@id": "88951798",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-16T14:27:23.000+02:00",
"@publishDate": "2016-06-16T14:27:23.000+02:00",
"@contactFormType": "LONG",
"realEstate": {
"@xsi.type": "expose:ApartmentRent",
"@id": "88951798",
"externalId": "54",
"title": "** Azubi's \/ Berufspendler - helles WG Zimmer in ruhiger Zweck- WG - Neustadt - nä. Flughafen **",
"creationDate": "2016-06-16T14:27:23.000+02:00",
"lastModificationDate": "2016-06-24T12:40:46.896Z",
"address": {
"postcode": "28199",
"city": "Bremen \/ Neustadt",
"quarter": "Neuenland",
"geoHierarchy": {
"continent": {
"geoCodeId": 1,
"fullGeoCodeId": "1"
},
"country": {
"name": "Deutschland",
"geoCodeId": 276,
"fullGeoCodeId": "1276"
},
"region": {
"name": "Bremen",
"geoCodeId": 5,
"fullGeoCodeId": "1276005"
},
"city": {
"name": "Bremen",
"geoCodeId": 1,
"fullGeoCodeId": "1276005001"
},
"quarter": {
"name": "Neuenland",
"geoCodeId": 147,
"fullGeoCodeId": "1276005001147"
},
"neighbourhood": {
"geoCodeId": 4011000021701
}
}
},
"descriptionNote": "** WG Zimmer in ruhiger Zweck-WG - mit Gemeinschaftsgarten **\n\nEs erwartet Sie ein kleines, helles Zimmer mit Echtholzfußboden in einer ruhigen 3er Wohngemeinschaft in der Bremer Neustadt.\n\nBitte geben Sie IMMER Ihre Telefonnummer mit an!",
"furnishingNote": "Das Zimmer ist ca. 13 qm groß, weiß gestrichen und hat einen gepflegten Dielenfußboden. In Gemeinschaft wird ein Vollbad mit Badewanne, Dusche und separaten WC genutzt. Ebenfalls eine helle freundliche Küche mit Einbauküche - zusammen mit dem Zimmer ca. 25 qm - . Ein kleiner Garten befindet sich am Haus, den alle Mieter nutzen dürfen. \n\nIn der WG wohnen zwei weitere ruhige Mieter, gesucht wird eine ergänzende ruige Person. Ideal ist diese WG für Berufspendler, Berufsstarter, Auszubildende oder Studenten.",
"locationNote": "Das Wohnhaus befindet sich links der Weser im Bremer Stadteil Neustadt. Kurze Wege zum Flughafen (mit dem Fahrrad 6 Minuten) und gute Anbindung zur B75 und A281. Einkaufsmöglchkeiten befinden sich in der Nähe der Wohnung. Mit Bus & Bahn erreicht man die City in wenigen Minuten.",
"otherNote": "Für weitere Informationen und Besichtigungen stehen wir Ihnen gern zur Verfügung. Bitte geben Sie immer Ihre Telefonnummer mit an!! Gesetzlicher Hinweis: Bitte beachten Sie, dass Sie uns mit Anforderung weiterer Informationen und Unterlagen zu diesem Immobilienangebot Ihre Einwilligung im Sinne des § 7 UWG geben, Sie über weitere Angebotsdetails telefonisch, per Email oder Fax zu unterrichten sowie Ihnen ggf. ein anderes geeignetes Mietangebot vorzustellen. Wir wollen unter keinen Umständen, dass unsere Kontaktaufnahme für Sie eine \"unzumutbare Belästigung\" im Sinne des § 7 UWG darstellt. Aus diesem Grund weisen wir ausdrücklich darauf hin, dass Sie jederzeit Ihre Einwilligung formlos telefonisch oder schriftlich bei uns widerrufen können.",
"attachments": [
{
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment",
"attachment": [
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/1",
"@id": "1",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Schlafzimmer Fensterseite",
"floorplan": "false",
"titlePicture": "true",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/2",
"@id": "2",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Schlafzimmer Rückseite",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/527\/495413527-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/3",
"@id": "3",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Küche E58",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig04\/N\/495\/413\/531\/495413531-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/4",
"@id": "4",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Badezimmer",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/533\/495413533-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/5",
"@id": "5",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Dusche",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/537\/495413537-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/6",
"@id": "6",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "separates WC",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig01\/N\/495\/413\/540\/495413540-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
},
{
"@xsi.type": "common:Picture",
"@xlink.href": "https:\/\/rest.immobilienscout24.de\/restapi\/api\/search\/v1.0\/expose\/88951798\/attachment\/7",
"@id": "7",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Garten",
"floorplan": "false",
"titlePicture": "false",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
{
"@scale": "SCALE_118x118",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/118x118%3E\/extent\/118x118\/format\/jpg"
},
{
"@scale": "SCALE_210x210",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/210x210%3E\/format\/jpg"
},
{
"@scale": "SCALE_540x540",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/540x540%3E\/format\/jpg"
},
{
"@scale": "SCALE",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/format\/jpg"
},
{
"@scale": "SCALE_AND_CROP",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/legacy_thumbnail\/%WIDTH%x%HEIGHT%\/format\/jpg"
},
{
"@scale": "WHITE_FILLING",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/545\/495413545-0.jpg\/ORIG\/resize\/%WIDTH%x%HEIGHT%%3E\/extent\/%WIDTH%x%HEIGHT%\/format\/jpg"
}
]
}
]
}
]
}
],
"referencePriceServiceCall": "https:\/\/www.immobilienscout24.de\/realestatevaluation\/ajax\/v2.2\/referenceprice\/region\/5\/city\/1\/district\/147?realEstateType=0&price=8.40&livingArea=25&firstTimeUse=false",
"referencePriceApiCall": "https:\/\/www.immobilienscout24.de\/realestatevaluation\/ajax\/v2.2\/referenceprice\/region\/5\/city\/1\/district\/147?realEstateType=0&price=8.40&livingArea=25&firstTimeUse=false",
"state": "ACTIVE",
"titlePicture": {
"@id": "1",
"@modification": "2016-06-24T12:40:46.896Z",
"@creation": "2016-06-24T12:40:46.896Z",
"@publishDate": "2016-06-24T12:40:46.896Z",
"title": "Schlafzimmer Fensterseite",
"floorplan": "false",
"titlePicture": "true",
"urls": [
{
"url": [
{
"@scale": "SCALE_60x60",
"@href": "https:\/\/pictureis24-a.akamaihd.net\/pic\/orig02\/N\/495\/413\/525\/495413525-0.jpg\/ORIG\/resize\/60x60%3E\/extent\/60x60\/format\/jpg"
},
}
}
答案 0 :(得分:0)
在您的示例中,expose.expose
是一个关联数组,但您正在像数组数组一样访问它。您可以像这样直接访问其成员:
echo $json['expose.expose']['@id'];