thinkphp整合百度地图示例源码演示下载

thinkphp整合百度地图示例源码演示下载
thinkphp整合百度地图示例源码演示下载,完整代码如下,仅供参考下:

 <?php    namespace AdminController;  use ThinkController;  class MapController extends Controller  {      public function _initialize()      {          if(empty($_SESSION['user'])){              $this->redirect('Index/index');          }      }      //所有数据      public function index(){            $data=M('Map')->select();          $this->assign('data',$data);          $this->display();      }      //添加      public function add(){          if(IS_POST){              if(empty(I('post.jd'))||empty(I('post.wd'))||empty(I('post.shop_name'))||empty(I('post.address'))){                  $this->error('请填写完整信息');              }              $data['jd']=trim(I('post.jd'));              $data['wd']=trim(I('post.wd'));              $data['shop_name']=trim(I('post.shop_name'));              $data['address']=trim(I('post.address'));              $data['tel']=trim(I('post.tel'));              $data['url']="http://api.map.baidu.com/marker?location=$data[wd],$data[jd]&title=位置&content=$data[shop_name]&output=html";              $res=M('Map')->add($data);              if($res){                  $this->redirect('Map/index');              }          }else{              $this->display();          }      }      //删除      public function del(){          $id=I('get.id','');          $res=M('Map')->where("id=$id")->delete();          if($res){              $this->success('删除成功');          }else{              $this->error('删除失败');          }      }        public function edit(){          if(IS_POST){              $id=trim(I('post.id'));              $data['jd']=trim(I('post.jd'));              $data['wd']=trim(I('post.wd'));              $data['shop_name']=trim(I('post.shop_name'));              $data['address']=trim(I('post.address'));              $data['tel']=trim(I('post.tel'));              $data['url']="http://api.map.baidu.com/marker?location=$data[wd],$data[jd]&title=位置&content=$data[shop_name]&output=html";              $res=M('Map')->where("id=$id")->save($data);              if($res){                  $this->success('成功','index');              }          }else{         laoji.org;     $id=I('get.id','');              $info=M('Map')->where("id=$id")->find();              $this->assign('info',$info);              $this->display();          }      }  } 前端页面代码 <!DOCTYPE html>  <html>  <head>      <meta charset="UTF-8">      <title>Title</title>  </head>  <body>  <center>      <table border="1">          <tr>              <td>公司号</td>              <td>公司名</td>              <td>公司地址</td>              <td>联系方式</td>              <td>地图</td>              <td><a href="{:U('Index/all')}">查看所有</a></td>          </tr>          <foreach name="data" item="val">              <tr>                  <td>{$val['id']}</td>                  <td>{$val['shop_name']}</td>                  <td>{$val['address']}</td>                  <td>{$val['tel']}</td>                  <td><a href="{$val['url']}">点击查看</a></td>              </tr>          </foreach>      </table>  </center>  </body>  </html>

演示参考:http://www.91luma.com/php/2666.html

搬瓦工,CN2高速线路,1GB带宽,电信联通优化KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

Vultr月付$3.5日本节点,512M内存/500G流量/1G带宽,电信联通优化,延迟低,速度快注册即送$50点击购买】!

阿里云香港、新加坡VPS/1核/1G/25G SSD/1T流量/30M带宽/年付¥288【点击购买】

腾讯云云产品特惠三折起【点击购买】

搬瓦工1111特惠,年付$29.882核CPU/2048MB内存/1TB流量/1GB带宽,随意切换机房KVM,延迟低,速度快,建站稳定,搬瓦工BandwagonHost VPS优惠码BWH26FXH3HIQ,支持<支付宝> 【点击购买】!

thinkphp整合百度地图示例源码演示下载

发表评论

电子邮件地址不会被公开。 必填项已用*标注

滚动到顶部