public function update_all()
{
$domain=M('domain');
$where['type']=1;
$domaininfo=$domain->where($where)->select();
unset($domain);
$modle=M();
foreach ($domaininfo as $value)
{
dump($value);
$this->update_once($value['host'],$value['dbname'],$value['dbuser'],$value['dbpass'],$value['prefix']);
}
}
public function update_once($host,$dbname,$dbuser,$dbpass,$prefix)
{
C('DB_HOST',$host);
C('DB_NAME',$dbname);
C('DB_USER',$dbuser);
C('DB_PWD',$dbpass);
$sql="show tables";
$modle=M();
$result = $modle->query($sql);
dump( C('DB_HOST'));
dump($result);exit;
} 最佳答案