Heim >Backend-Entwicklung >PHP-Tutorial > [有关问题]js数组和php数组的重口味关系
[问题]js数组和php数组的重口味关系
这两天在学习js 的图表生成.其中需要给js 传递这么一个数组.这是范例内的数组.所以现在的问题是
有没有快捷的方式通过php来生成这个数组? 还是需要根据这个数组结构自己人肉的用php来各种组合?
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> series:[ { type:"column", name:"阿里巴巴", data:[3, 2, 1, 3, 4] }, { type:"column", name:"John", data:[2, 3, 5, 7, 6] }, { type:"column", name:"Joe", data:[4, 3, 3, 9, 0] }, { type:"spline", name:"Average", data:[3, 2.67, 3, 6.33, 3.33], marker:{ lineWidth:2, lineColor:Highcharts.getOptions().colors[3], fillColor:"white" } }, { type:"pie", name:"Total consumption", data:[ { name:"Jane", y:13, color:"#4572A7" // Jane"s color }, { name:"John", y:23, color:"#AA4643" // John"s color }, { name:"Joe", y:19, color:"#89A54E" // Joe"s color } ], center:[100, 80], size:100, showInLegend:false, dataLabels:{ enabled:false } } ]