当我尝试将其上载到webhost时显示Uncaught SyntaxError: Unexpected token '<'
错误,而在使用本地主机时显示正确,没有任何错误。我使用的php版本也与虚拟主机相同。
这是高图代码
$(function(){
var chart = new Highcharts.Chart({
chart: {
renderTo: 'graph',
scrollablePlotArea: {minWidth: 700},
},
xAxis: {
categories: [<?php echo join($arrayTanggal, ',') ?>],
tickWidth: 0,
gridLineWidth: 1,
labels: {
align: 'left',
x: -40,
y: -3
}
},
yAxis: [{ // left y axis
title: {
text: null
},
labels: {
align: 'left',
x: 3,
y: 16,
format: '{value:.,0f}'
},
showFirstLabel: false
}, { // right y axis
linkedTo: 0,
gridLineWidth: 0,
opposite: true,
title: {
text: null
},
labels: {
align: 'right',
x: -3,
y: 16,
format: '{value:.,0f}'
},
showFirstLabel: false
}],
legend: {
align: 'left',
verticalAlign: 'top',
borderWidth: 0
},
tooltip: {
shared: true,
crosshairs: true
},
series: [{
name: 'Overall',
color: '#dc3545',
data: [<?php echo join($arrayAverage, ',') ?>],
lineWidth: 3,
marker: {
radius: 8
}
},]
});
});
感谢您可以提供的任何帮助
答案 0 :(得分:1)
在PHP中,join
是implode
的别名。所以正确的语法是implode ( string $glue , array $pieces ) : string
。
答案是:
<?php echo implode(',', $arrayTanggal) ?>