t.replace不是函数(…)修剪

当我检入console.log时,以下是在问题中产生错误并且它会破坏它

var map = L.map('map').setView([0, 0], 2);  // Now this should look something like {"Australia": "2006 2010 "} var classNameMap = ; geojson = L.geoJson(statesData, { style: function(feature) { // Here is where we got the issue var classes = classNameMap[feature.properties.sovereignt]; if (classes) { return {className: classes}; } }, }).addTo(map); 

UPDATE

通过查看console.log,它指向我在库中的一行:

 ...t.replace(/^\s+|\s+$/g,"")},splitWords:function(t){return o.Util.trim(t).split(/\s+/)}... 

“@ Fred-ii-lol非常棒。非常感谢。把它放在答案中,我会接受它。 – rob.m”

根据OP的要求:

+= get_field('year') + ' '

您可能来自JS / C背景,并认为+符号可用于PHP中的连接。 PHP正在考虑你想要做数学的加号。

它是在PHP中连接的点:

 .= get_field('year') . ' '