注册网站域名平台,无锡微网站,怎么用wordpress建立自己的网站吗,三河市最新消息考试类型的表jx_exam_type#xff0c;可后台添加内容考试成绩的表jx_result#xff0c;可后台添加内容期中考试成绩表中的exam_id对应考试类型表中的id#xff0c;也就是添加的成绩是属于期中还是期末然后使用php查询$sqlSELECT re.type, re.score, re.exam_id, et.ti…考试类型的表jx_exam_type可后台添加内容考试成绩的表jx_result可后台添加内容期中考试成绩表中的exam_id对应考试类型表中的id也就是添加的成绩是属于期中还是期末然后使用php查询$sqlSELECT re.type, re.score, re.exam_id, et.title, DATE_FORMAT(et.addtime, %Y-%m-%d) AS etime FROM jx_result AS re LEFT JOIN jx_exam_type AS et ON re.exam_id et.id WHERE re.uid $uid ORDER BY et.addtime DESC;$result$db-query($sql);while($row$result-fetch_assoc()){$arr[]$row;}echo json_encode($arr);输出的格式如下[{type: 语文,score: 91,exam_id: 2,title: 三年级期末考试,etime: 2017-06-02},{type: 英语,score: 89,exam_id: 2,title: 三年级期末考试,etime: 2017-06-02},{type: 数学,score: 60,exam_id: 2,title: 三年级期末考试,etime: 2017-06-02},{type: 数学,score: 91,exam_id: 1,title: 三年级期中考试,etime: 2017-05-25},{type: 语文,score: 85,exam_id: 1,title: 三年级期中考试,etime: 2017-05-25},{type: 英语,score: 87,exam_id: 1,title: 三年级期中考试,etime: 2017-05-25}]请问我如何才能将以上输出的json格式变为以下这种{title: 三年级期中考试,etime: 2017-05-25,exam_id: [{type: 数学,score: 91,exam_id: 1},{type: 语文,score: 85,exam_id: 1},{type: 英语,score: 87,exam_id: 1}],title: 三年级期末考试,etime: 2017-06-02,exam_id: [{type: 语文,score: 91,exam_id: 2},{type: 英语,score: 89,exam_id: 2},{type: 数学,score: 60,exam_id: 2}]}变为以上这种格式后输出到前台通过JS来输出到html上面(可能我写的想要的格式有问题不过大概意思就是将原来的数据根据exam_id来归类一下再输出)目前正在学习中很多地方不是很懂求指教~~谢谢