我有以下的JSON:排序JSON輸出
{
"row": [
{
"sort":3,
"type":"fat",
"widgets":
[
{"values": [3,9] },
{"values": [8,4] }
]
},
{
"sort":2,
"type":"three",
"widgets":
[
{"values": [3,4] },
{"values": [12,7] },
{"values": [12,7] }
]
}
]
}
這PHP輸出它:
foreach ($value->row as $therow)
{
echo "<div class='row ".$therow->type."'>";
foreach ($therow->widgets as $thewidgets)
{
echo "<div class='widget'>";
echo $thewidgets->values[0];
echo "</div>";
}
echo "</div>";
}
我想這樣做是有點基礎上的輸出中在JSON中排序值,有什麼想法?
什麼樣的排序將是「2」或「3」? – Gumbo 2009-05-20 12:46:00