<?php
namespace app\components;

class SecretHelper{

	//数据库服务器1
	public static $gjs_db1_config = array(
		"host" => "192.168.1.250",
		"port" => "1433",
		"user" => "sa",
		"pass" => "sql\$Server123456",
		"name" => "gjs_home_real1",
		"owner" => "dbo"
	);
	
	//数据库服务器2
	public static $gjs_db2_config = array(
		"host" => "192.168.1.250",
		"port" => "1433",
		"user" => "sa",
		"pass" => "sql\$Server123456",
		"name" => "gjs_home_real2",
		"owner" => "dbo"
	);
	
	//数据库服务器3
	public static $gjs_db3_config = array(
		"host" => "192.168.1.250",
		"port" => "1433",
		"user" => "sa",
		"pass" => "sql\$Server123456",
		"name" => "gjs_home_real3",
		"owner" => "dbo"
	);
		
	public static function Create_sqlserver_dbh($dbconfig){
		$dsn = "sqlsrv:Server=". $dbconfig["host"];
		if(!empty($dbconfig["port"])){
			$dsn .= ",". $dbconfig["port"];
		}
		$dsn .= ";Database=". $dbconfig["name"];
		$username = $dbconfig["user"];
		$password = $dbconfig["pass"];
		$dbh = new \PDO($dsn, $username, $password);
		return $dbh;
	}
	
}
?>