PHP区域联动后端接口与数据表设计
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                PHP区域联动后端接口与数据表设计
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                控制器
/*** 獲取所有省份*/public function getProv(){$data = $this->AreaModel->getProv();self::_return($data);}/*** 獲取指定省份的城市*/public function getCity(){$id = $_POST['id'];$data = $this->AreaModel->getCity($id);self::_return($data);}/*** 獲取指定城市的區域*/public function getArea(){$id = $_POST['id'];$data = $this->AreaModel->getArea($id);self::_return($data);}模型
/*** 獲取所有省*/public function getProv(){$cols = '`provid`, `prov`';$where = [];$order = '`orderby` ASC';return $this->table($this->prov)->cols($cols)->where($where)->order($order)->select()->fetchAll();}/*** 獲取指定省份的城市*/public function getCity($id){$cols = '`cityid`, `city`';$where = ['provid' => $id];$order = '`orderby` ASC';return $this->table($this->city)->cols($cols)->where($where)->order($order)->select()->fetchAll();}/*** 獲取指定城市的區域*/public function getArea($id){$cols = '`areaid`, `area`';$where = ['cityid' => $id];$order = '`orderby` ASC';return $this->table($this->area)->cols($cols)->where($where)->order($order)->select()->fetchAll();}表格
總結
以上是生活随笔為你收集整理的PHP区域联动后端接口与数据表设计的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: pe是啥意思
- 下一篇: 亿纬锂能股票能否长期持有 需要通过不同
