当前位置: 首页>>代码示例>>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;未经允许,请勿转载。