时间:2021-07-01 10:21:17 帮助过:24人阅读
文件1 $search_db = new SearchDo(); if ($search_db->connect() === false) { //数据库连接 exit; } if( $area_kubun_id == '') { //地域 $list_area = new AreaList(); $area_list = $list_area->createList(); $smarty->assign('area_list', $area_list); }else { $area_list =$search_db->getAreaById($area_kubun_id); $smarty->assign('area_list', $area_list); } 文件2 class AreaList extends SelectList { function AreaList(){ $sql = SQL_AREA_LIST_SELECT; $this->sql = $sql; $this->SelectList(); } } 文件3 class SelectList extends BoatDb { function SelectList() { $this->BoatDb(); $this->connect(); // 数据库连接 } function createList() { --数据库操作-- $this->close();// 关闭连接 } }