/*初始化*/
public function __construct($config = array()){
if($config) $this->connect($config);
}
public function __destruct(){
foreach($this->connector as $index => $connect)
$this->{'_'.$this->configs[$index]['dbtype'].'_close'}($connect);
}
private function _mysql_close($connect){
mysqli_close($connect);
}
/*选择毗连*/
public function selectConnect($index){
return isset($this->connector[$index]) && (($this->active = $index) || true);
}
/*创立毗连*/
public function connect($config){
(!isset($config['index'])) && $config['index'] = $this->default_config['index']++ ;
$config = Core::inHerit($this->default_config,$config);
!in_array($config['dbtype'],array('mysql')) && Core::throwError('未撑持的数据库类型');
extract($config);
$this->configs[$index] = $config;
$this->{'_'.$config['dbtype'].'_connect'}($user, $pwd,$host,$dbname,$charset,$index,$port);