I have one problem here. I'm using file as cache for storing MySQL result. Here are the results inside the cache file:
[
{
"Name":"Bell",
"Class":"BWB0",
"Lv":31,
"Kill":0,
"Serial":3,
"PvpPoint":0,
"Death":0
},
{
"Name":"Perkss",
"Class":"AWB0",
"Lv":17,
"Kill":0,
"Serial":6,
"PvpPoint":2400,
"Death":0
},
{
"Name":"1233",
"Class":"BWB0",
"Lv":3,
"Kill":0,
"Serial":1,
"PvpPoint":0,
"Death":0
},
{
"Name":"Cora",
"Class":"CWB0",
"Lv":1,
"Kill":0,
"Serial":4,
"PvpPoint":0,
"Death":0
}
]
Any idea to convert the result cache file into usual output ? like "echo $row['Name']".
Thanks, I'm just a newbie want to learn PHP :)
$json_string = '[{"Name":"Bell","Class":"BWB0","Lv":31,"Kill":0,"Serial":3,"PvpPoint":0,"Death":0},{"Name":"Perkss","Class":"AWB0","Lv":17,"Kill":0,"Serial":6,"PvpPoint":2400,"Death":0},{"Name":"1233","Class":"BWB0","Lv":3,"Kill":0,"Serial":1,"PvpPoint":0,"Death":0},{"Name":"Cora","Class":"CWB0","Lv":1,"Kill":0,"Serial":4,"PvpPoint":0,"Death":0}]';
$a = json_decode($json_string, true);
foreach($a as $row)
{
echo $row['Name'];
}