```
public function test7()
{
// 获取省份
$province = Db::name('region')->where(array('parent_id'=>0,'level'=>1))->select();
$this->assign('province',$province);
return $this->fetch();
}
/*
* 获取地区
*/
public function getRegion(){
$parent_id = input('parent_id');
$data = Db::name('region')->where("parent_id", $parent_id)->select();
$html = '';
if($data){
foreach($data as $h){
$html .= "<option value='{$h['id']}'>{$h['name']}</option>";
}
}
echo $html;
}
```