0
所以我構建了一個傳遞給PHP的對象數組,但我想知道這是傳遞它們的最簡潔的方法,並且將是PHP中最容易處理的方法。從javascript傳遞數組對象到php
我的部分組件數量是基於我的谷歌地圖反向地理編碼器返回的變量而被部分拋棄。
每個小組將被插入作爲一個單獨的一行到MySQL用「名」和「類型」
var neighborhood = extractLongFromAddress(results[0].address_components, "sublocality");
var town = extractLongFromAddress(results[0].address_components, "locality");
var stateShort = extractShortFromAddress(results[0].address_components, "administrative_area_level_1");
var stateLong = extractLongFromAddress(results[0].address_components, "administrative_area_level_1");
var country = extractLongFromAddress(results[0].address_components, "country");
var groups=[];
if(town && stateShort){
groups.push({name: town+", "+stateShort,
type:"city"
});
}
if(neighborhood && stateLong){
groups.push({name: neighborhood+", "+stateShort,
type:"neighborhood"
});
}
if(stateLong){
groups.push({name:stateLong,
type:"state"
});
}
if(country){
groups.push({name:country,
type:"country"
});
}
console.log(groups);
真誠的感謝所有幫助的參數。非常感謝。
非常感謝,我會盡力把這個。 – ambe5960 2015-01-21 00:58:03