3.2.1 - 严重 - 未处理
'DB_CONFIG1' => array('db_type' => 'mysql',
'db_user' => 'xxx,bbb',
'db_pwd' => 'xxx,bbb',
'db_host' => 'xxx,bbb',
'db_port' => '3306',
'db_name' => 'portal'
),
'DB_CONFIG2' => array(
'db_type' => 'mysql',
'db_user' => 'xxx,ccc',
'db_pwd' => 'xxx,ccc',
'db_host' => 'xxx,ccc',
'db_port' => '3306',
'db_name' => 'portal'
),
protected function multiConnect($master=false) {
static $_config = array();
if(empty($_config)) {
// 缓存分布式数据库配置解析
foreach ($this->config as $key=>$val){
$_config[$key] = explode(',',$val);
}
}
这里$_config设为静态的所有的数据库配置都只能加载到第一次循环的 $_config
