예제 #1
0
 /**
  * 连接Mysql数据库
  */
 public function connect()
 {
     $mysql_config = getMysqlConfig();
     $host = $mysql_config['host'];
     $user = $mysql_config['username'];
     $pwd = $mysql_config['password'];
     $port = $mysql_config['port'];
     $db_name = $mysql_config['db_name'];
     @($link = mysql_connect($host . ':' . $port, $user, $pwd)) or die("error.................... Can't connect to the mysql server! Please check the APP configuration!");
     mysql_query("SET NAMES utf8");
     mysql_select_db($db_name, $link);
     return true;
 }
예제 #2
0
 /**
  * 获取数据库前缀
  */
 private function getDbPrefix()
 {
     $mysql_config = getMysqlConfig();
     return $mysql_config['db_prefix'];
 }