【发布时间】:2021-11-28 09:33:54
【问题描述】:
我正在使用显示测验的 json 结构,但现在我不明白如何正确显示它,请帮助我,我想从数据库中读取信息并显示在下面的 json 结构中,谢谢
[
{
"question_id" : 0,
"question": "What is the original native name of Mount Rainier?",
"answers": [
{"id": 0, "text": "Tahoma"},
{"id": 1, "text": "Shuksan"},
{"id": 2, "text": "Stillaguamish"}
],
"correct": 0
},
{
"question_id" : 1,
"question" : "Which image shows a close-up of the Nisqually Glacier?",
"answers" : [
{"id" : 0, "image" : "images/quizImages/glacier_01.jpg" },
{"id" : 1, "image" : "images/quizImages/glacier_02.jpg" },
{"id" : 2, "image" : "images/quizImages/glacier_03.jpg" },
{"id" : 3, "image" : "images/quizImages/glacier_04.jpg" }
],
"correct" : 3
}
]
【问题讨论】:
-
你使用 MySQLi 还是 PDO ?
-
你到底卡在哪里了?请参阅tour 和How to Ask...您需要提出一些更专注和具体的问题。我们不知道您是否甚至知道如何编写 SELECT 查询,或者是否存在关于 JSON 或其他什么的更特殊的问题。
-
@The House 请分享您的努力,直到您尝试过的地方