在下面的代码中,我尝试为lineDash分配一个值。如果我使用[10,5]它就像一个魅力。但它使用数组变量名称不起作用。怎么了?
$dash = [10,5];
"MultiLineString": [new ol.style.Style({
stroke: new ol.style.Stroke({
color: "'.$a_Colour.'",
width: "'.$a_gpx_line_width.'",
lineDash: [10,5] // does work but $dash does not work but
})
})]
};';
根据你的php版本,尝试使用
$dash = array(10,5);
代替
$dash = [10,5];
最后我发现了这个问题。似乎整个MultilineString需要作为字符串传递。所以lineDash的代码必须是:lineDash:['。$ dash [0]。','。$ dash [1]。']变为:lineDash:[10,5]在String Var中