2017-12-30 8 views
-4
{ 
"total_count":3, 
"offset":2, 
"limit":2, 
"notifications": 
    [ 
     { 
    "id":"481a2734-6b7d-11e4-a6ea-4b53294fa671", 
    "successful":15, 
    "failed":1, 
    "converted":3, 
    "remaining":0, 
    "queued_at":1415914655, 
    "send_after":1415914655, 
    "canceled": false, 
    "url": "https://yourWebsiteToOpen.com", 
    "data":null, 
     "headings":{ 
     "en":"English and default langauge heading", 
     "es":"Spanish language heading" 
    },  
    "contents":{ 
     "en":"English and default content", 
     "es":"Hola" 
     } 
    }, 
    { 
    "id":"b6b326a8-40aa-13e5-b91b-bf8bc3fa26f7", 
    "successful":5, 
    "failed":2, 
    "converted":0, 
    "remaining":0, 
    "queued_at":1415915123, 
    "send_after":1415915123, 
    "canceled": false, 
    "url": nil, 
    "data":{ 
     "foo":"bar", 
     "your":"custom metadata" 
    }, 
    "headings":{ 
     "en":"English and default langauge heading", 
     "es":"Spanish language heading" 
    }, 
    "contents":{ 
     "en":"English and default content", 
     "es":"Hola" 
     } 
    } 
    ] 
    } 
+0

Ich habe versucht, einen json_decode() zu machen, aber Fehler dieses Textes zu bekommen. – halojoy

+0

ist das die gesamte Antwort? – RamRaider

+0

Es gibt keine Nil in JSON, es muss null sein –

Antwort

0

Sie wollen Angenommen, Ihre JSON-Daten innerhalb einer HTML-Tabelle angezeigt werden, hier ist ein einfaches Beispiel:

<?php 

$json=<<<JSON 
[ 
    { 
     "name": "foo", 
     "age": 23, 
     "mood": "happy" 
    }, 
    { 
     "name": "bar", 
     "age": 38, 
     "mood": "sad" 
    } 
] 
JSON; 
$people = json_decode($json); 
?> 
<html> 
<table> 
    <thead> 
     <tr><th>Name</th><th>Age</th><th>Mood</th></tr> 
    </thead> 
    <tbody> 
    <?php foreach($people as $person): ?> 
    <tr> 
     <td><?= $person->name; ?></td> 
     <td><?= $person->age; ?></td> 
     <td><?= $person->mood; ?></td> 
    </tr> 
    <?php endforeach; ?> 
    </tbody> 
</table> 
</html>