0
如何在JavaScript中讀取PHP中的數組?像這樣使用PHP將值傳遞給JavaScript
<?php
$f(0)=69;
$f(1)=8;
$f(2)=25;
$f(3)=5;
$f(4)=32;
?>
<script>
var barChartData = {labels : ["Ene","Feb","Mar","Abr","May","Jun","Jul"],
datasets : [
{
fillColor : "#e64608", strokeColor : "#e64608",
data:[65,59,90,81,56,55,40]
},
{
fillColor : "#acadb1", strokeColor : "#acadb1", data :
[28,48,40,19,96,27,100]
}
]
}
var myLine = new
Chart(document.getElementById("bar").getContext("2d")).
Bar(barChartData);
</script>
我想用數組中的數據替換數據中的「數據」。
請了解如何使用[PHP的'陣列()'](http://php.net/manual/en/language.types.array.php#language.types.array.syntax.array -func) –