43 lines
799 B
PHP
43 lines
799 B
PHP
<?php
|
|
namespace Sookon\Helpers;
|
|
|
|
use Zend\View\Model\ViewModel;
|
|
use Zend\View\Model\JsonModel;
|
|
use Zend\View\Renderer\PhpRenderer;
|
|
use Sookon\Helpers\PDO;
|
|
|
|
class Area
|
|
{
|
|
private $db; //传入PDO对象.
|
|
private $product = 0; //产品环境
|
|
|
|
function __construct()
|
|
{
|
|
$this->db = new PDO();
|
|
}
|
|
|
|
public function getProvince()
|
|
{
|
|
$sql = "SELECT * FROM map_provinces";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetchAll();
|
|
return $rows;
|
|
}
|
|
|
|
public function getCity($pid)
|
|
{
|
|
$sql = "SELECT * FROM map_cities WHERE provinceid=$pid";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetchAll();
|
|
return $rows;
|
|
}
|
|
|
|
public function getArea($cid)
|
|
{
|
|
$sql = "SELECT * FROM map_areas WHERE cityid=$cid";
|
|
$rs = $this->db->query($sql);
|
|
$rows = $rs->fetchAll();
|
|
return $rows;
|
|
}
|
|
|
|
} |