foreach ($res as $row) { echo '"' . $row[1] . '":"' . $row[2] . '",';}//----"a":"1","b":"2","c":"3","d":"4",
你是要返回json格式的吧,这种方法输出兼容性不好,如果数据里面包含了双引号,输出的格式就乱了。
输出json最好用json_encode函数