$rs = [
"h" => ["id", "name", "region"],
"d" => [
[100, "wang", "shanghai"],
[101, "huang", "beijing"],
[102, "zhang", "beijing"],
[103, "li", "shanghai"],
]
];
$ret = rs2Array($rs);
print json_encode($ret);
/* 期望结果为:
[
{id: 100, name: "wang", region: "shanghai"},
{id: 101, name: "huang", region: "beijing"},
{id: 102, name: "zhang", region: "beijing"},
{id: 103, name: "li", region: "shanghai"}
]
*/
rs2Array函数如下: