$sql = "SELECT * FROM `scripts` LIMIT 0, 30 ";
$result = mysql_query($sql) or die ('Error updating database: ' . mysql_error());
$json = array();
if(mysql_num_rows($result)) {
while($row=mysql_fetch_row($result)) {
$json['table data'][]=$row;
}
}
$encoded = json_encode($json);
echo $encoded;
这是我的输出:
{"table data":[["1","test","30","13"],["2","test2","40","14"]]}
如何访问数组的单个部分,它是一个数组数组?我先解码吗?