private function Connect() { if (!self::$_connectSource) { if (Config::Instance()->DB["port"] != "") { //存在端口号 self::$_connectSource = mysql_connect(Config::Instance()->DB["host"] . ":" . Config::Instance()->DB["port"], Config::Instance()->DB["user"], Config::Instance()->DB["password"]); } else { self::$_connectSource = mysql_connect(Config::Instance()->DB["host"], Config::Instance()->DB["user"], Config::Instance()->DB["password"]); } if (!self::$_connectSource) { throw new Exception("mysql connect error" . mysql_error()); } mysql_select_db(Config::Instance()->DB["database"], self::$_connectSource); mysql_query("set names UTF8", self::$_connectSource); } return self::$_connectSource; }