【发布时间】:2013-04-12 03:21:37
【问题描述】:
我需要制作生成 json 数据的示例 php 代码,如下所示:
?(/* AAPL historical OHLC data from the Google Finance API */
[
/* Apr 2006 */
[1145404800000,65.65],
[1145491200000,67.63],
[1145577600000,67.04],
[1145836800000,65.75],
[1145923200000,66.17],
[1146009600000,68.15],
[1146096000000,69.36],
[1146182400000,70.39],
/* May 2006 */
[1146441600000,69.60],
[1146528000000,71.62],
[1146614400000,71.14],
[1146700800000,71.13],
[1146787200000,71.89],
[1147046400000,71.89],
[1147132800000,71.03],
[1147219200000,70.60],
[1147305600000,68.15],
[1147392000000,67.70],
[1147651200000,67.79],
[1147737600000,64.98],
[1147824000000,65.26],
[1147910400000,63.18],
[1147996800000,64.51],
[1148256000000,63.38],
[1148342400000,63.15],
[1148428800000,63.34],
[1148515200000,64.33],
[1148601600000,63.55],
[1148947200000,61.22],
[1149033600000,59.77],
/* Apr 2013 */
[1364774400000,428.91],
[1364860800000,429.79],
[1364947200000,431.99],
[1365033600000,427.72],
[1365120000000,423.20],
[1365379200000,426.21],
[1365465600000,426.98],
[1365552000000,435.69],
[1365638400000,434.33],
[1365724800000,429.80],
[1365984000000,419.85],
[1366070400000,426.24]
]);
*编辑
这样的数据:http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?
但没有将外部 json 脚本加载到 php 脚本中。只需在一个脚本 php 中生成 json 数据。我怎样才能做出这样的?
【问题讨论】:
-
数据从何而来,简单的打印对您有用吗,还是您需要其他东西?如果您需要其他内容,您能说得更具体些吗?
-
我也没有得到这个问题,请更具体
-
数据来自数据库,但基本上我需要将此数据打印为 json...所以我需要在 json 中生成此数组的示例代码...
-
我在问题被否决之前对其进行了编辑,请给我理由来否决这个问题。
标签: php javascript jquery ajax json