當前位置: 首頁>>代碼示例>>PHP>>正文


PHP global_common::getLocation方法代碼示例

本文整理匯總了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];
         }
開發者ID:vietlethanh,項目名稱:KooKooBackEnd,代碼行數:31,代碼來源:import_store.php


注:本文中的global_common::getLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。