本文整理汇总了PHP中global_common::getLocation方法的典型用法代码示例。如果您正苦于以下问题:PHP global_common::getLocation方法的具体用法?PHP global_common::getLocation怎么用?PHP global_common::getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类global_common
的用法示例。
在下文中一共展示了global_common::getLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
for ($index = 1; $index <= $total / Model_Store::NUM_PER_PAGE + 1; $index++) {
$allStores = $objStore->getAllStore($index);
//print_r($allStores);
//break;
foreach ($allStores as $store) {
// print_r($store);
//add urlencode to your address
$rawAddr = $store[global_mapping::Address] . ', ' . $store[global_mapping::DistrictName] . ', ' . str_replace("TP.", "", $store[global_mapping::CityName]) . ', Việt Nam';
//$address = urlencode($rawAddr);
//$address = str_replace(" ", "+", $address);
//echo $rawAddr;
if ($store[global_mapping::Latitude] == '10.8230990000' && $store[global_mapping::Longitude] == '106.6296640000') {
echo '<br>Start get lat long: ' . $rawAddr;
//$json = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false");
//$json = json_decode($json);
$mapLocation = global_common::getLocation($_gmapAPI, $rawAddr);
$lat = $mapLocation['lat'];
$long = $mapLocation['long'];
if ($lat && $long) {
$result = $objStore->update($store[global_mapping::StoreID], $store[global_mapping::Name], $store[global_mapping::Address], $store[global_mapping::DistrictID], $store[global_mapping::CityID], $store[global_mapping::Phone], $store[global_mapping::SpecialDesc], $lat, $long, $store[global_mapping::WorkingDay], $store[global_mapping::MainCategoryId], $store[global_mapping::StoreIcon], $store[global_mapping::StoreImage], $store[global_mapping::Status], $store[global_mapping::CreatedBy], $store[global_mapping::CreatedDate], $store[global_mapping::UpdatedBy], $store[global_mapping::UpdatedDate], $store[global_mapping::DeletedBy], $store[global_mapping::DeletedDate]);
if ($result) {
echo "<br>Update successfull " . "Name:" . $store[global_mapping::Name] . " Address:" . $store[global_mapping::Address];
} else {
echo "<br>Update failed " . "Name:" . $store[global_mapping::Name] . " Address:" . $store[global_mapping::Address];
}
} else {
echo "<br>Update failed. Can't get geo of " . "Name:" . $store[global_mapping::Name] . " Address:" . $store[global_mapping::Address];
}
} else {
echo "<br>Update already." . "Name:" . $store[global_mapping::Name] . " Address:" . $store[global_mapping::Address];
}