【发布时间】:2013-07-07 05:25:53
【问题描述】:
首先,请看一下这个 JSON http://ws.luyencong.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.luyencong.net/data/search/json.txt
我们将不胜感激。谢谢你。
祝你有美好的一天!
【问题讨论】:
-
所以你想让我们告诉你用 [] 包装你的 JSON? :)
-
请包括一个简单的例子:输出现在看起来如何,应该看起来如何。链接的输出不可读。
-
你想要一个包含
B\u1ed1 c\u00e1o th\u00e0nh l\u1eadp di\u1ec5n \u0111\u00e0n Luy\u1ec7n C\u00f4ng这样的键的 json 哈希?