Json
data ={
"2":
{
"routtype":"Transactional",
"credit":40000,
"validity":"4616",
"availablecredit":"39457"
}
}
如何逐个将此数据提取到变量中
答案 0 :(得分:2)
假设$ json_array为你的数组。
$data = json_decode($json_array);
foreach($data as $dt){
$routtype = $dt->routtype;
$credit = $dt->credit;
$validity = $dt->validity;
$availablecredit = $dt->availablecredit;
echo $routtype;
echo $credit;
echo $validity;
echo $availablecredit;
}