将Php 2D数组转换为highcharts中的javascript数组

时间:2014-07-03 15:13:00

标签: javascript php arrays highcharts

我在php中有一个二维数组

Array ( [0] => Array ( [date] => 16/06/2014 [total_booking] => 2 ) [1] => Array ( [date] => 16/06/2014 [total_booking] => 1 ) [2] => Array ( [date] => 16/06/2014 [total_booking] => 1 ) [3] => Array ( [date] => 17/06/2014 [total_booking] => 1 ) [4] => Array ( [date] => 18/06/2014 [total_booking] => 1 ) [5] => Array ( [date] => 18/06/2014 [total_booking] => 1 ) ) 

我想在highcharts中使用此数组作为x轴的日期和y图表中的总预订, 如何将此数组转换为javascript array.please help。

1 个答案:

答案 0 :(得分:1)

在将其发送到javascript之前使用json_encode($array);