ich einige codierte json wie dieses:Decode JSON jedes Array an PHP
[
{"title":"root", "link":"one"},
{"title":"branch", "link":"two"},
{"title":"leaf", "link":"three"}
]
ich, dass JSON in PHP Ausgabe entschlüsseln wollen wie:
title || link
root || one
branch || two
leaf || three
ich versucht, dies aber nicht funktioniert :
$list = json_decode($json);
foreach ($list as $list => $value) {
echo $list->title;
echo $list->link;
}
aber ich versuchte, diesen Link http zu kodieren://penanggulangankrisis.kemkes.go.id/ipaddress/api_ip.php und es sagt ungültiges foreach Argument Ich benutze json_decode (file_get_contents ($ url2), true); und $ url2 = "http://penanggulangankrisis.kemkes.go.id/ipaddress/api_ip.php"; –
@dennisramli var_dump file_get_contents, was ist das Ergebnis? "Null"? – DevNiels
nein ,, das Ergebnis ist nicht null @DevNiels –