Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将这种类型的数组转换为列表?_Php_Arrays_List_Codeigniter - Fatal编程技术网

Php 如何将这种类型的数组转换为列表?

Php 如何将这种类型的数组转换为列表?,php,arrays,list,codeigniter,Php,Arrays,List,Codeigniter,我正在尝试将数据插入codeigniter的highcharts中。Highcharts希望数据是这样的列表[31398552381237] 但从我的查询中,我从var_dump($revenue)得到了这个结果: 我希望结果是这样的: [2838475, 136246.8, 3406170, 3655955.8, 4132819.6, 4087404, 1271636.8, 499571.6, 9764354, 713933.232, 714614.466, 2827121.1, 1793

我正在尝试将数据插入codeigniter的highcharts中。Highcharts希望数据是这样的列表[31398552381237]

但从我的查询中,我从var_dump($revenue)得到了这个结果:

我希望结果是这样的:

[2838475, 136246.8, 3406170, 3655955.8, 4132819.6, 4087404, 
1271636.8, 499571.6, 9764354, 713933.232, 714614.466, 
2827121.1, 1793916.2, 2066409.8]

有什么建议吗?或任何参考资料?我被困在这个问题上一周了,而不是
$revenue[$key]['data']=$value->revenue使用
$revenue[]=$value->revenue


echo json_encode($revenue)
将按照您的预期提供数组列表。

。或者只需将
$revenue[$key]['data']
更改为
$revenue[]
,如果您还想知道如何使
[]
做好高图准备,请使用。
[2838475, 136246.8, 3406170, 3655955.8, 4132819.6, 4087404, 
1271636.8, 499571.6, 9764354, 713933.232, 714614.466, 
2827121.1, 1793916.2, 2066409.8]