我有像这样的数据库的结果数组
Array ( [0] => Array ( [days] => October, 2014 [ispaid] => 1 [total] => 1683 [sales] => 3 ) [1] => Array ( [days] => September, 2014 [ispaid] => 1 [total] => 521 [sales] => 5 ) )
现在我想以json格式转换它,如
var data = google.visualization.arrayToDataTable([
['Month', 'Sales', 'Leads', 'Earnings'],
**['January 2014', 171, 171, 520],
['February 2014', 192, 125, 2258],
['March 2014', 62, 142, 1725],
['April 2014', 115, 150, 1412],
['May 2014', 48, 265, 1586],
['June 2014', 556, 185, 1589]**
]);
我怎么能这样做
答案 0 :(得分:3)
您是否尝试过json_encode
功能?它应该将任何PHP数组转换为JSON字符串