当我运行时:
while($r = mysql_fetch_assoc($result3)) {
echo json_encode($r);
}
结果是:
{"test1":"1","test2":"2","test3":"3","test4":"4"}
{"test1":"5","test2":"5","test3":"7","test4":"8"}
我的问题是:如果知道行数不固定,我如何根据上面的结果创建数组,它可能会根据数据而变化。因此,我可以对数组进行更改并以类似于以下的格式对其进行解析:
["test1"=>"1","5"],
["test2"=>"2","6"],
["test3"=>"3","7"],
["test4"=>"4", "8"]
谢谢!!