首先,请看一下这个 JSON http://ws.luyancong.net/data/search/query.php?do=json
这是它的代码:
/* --- Execute query and get the data. --- */
$query = $db->query("SELECT t.* FROM ".TABLE_PREFIX."threads t");
while($data = $db->fetch_array($query))
{
$results[] = array($data['subject'] => $data['subject']);
$json = json_encode($results, JSON_FORCE_OBJECT);
}
/* --- Print the results to the screen, for future purposes. --- */
echo $json;
但我希望输出 JSON 格式如下所示:http ://ws.luyancong.net/data/search/json.txt
帮助将不胜感激。感谢一切。
祝你有美好的一天!