Skip to content

Instantly share code, notes, and snippets.

@why168
Created July 10, 2017 08:58
Show Gist options
  • Save why168/ed8e23d59ad367ab15d890dc7d5168fc to your computer and use it in GitHub Desktop.
Save why168/ed8e23d59ad367ab15d890dc7d5168fc to your computer and use it in GitHub Desktop.
数据库配置文件
<?php
/**
* 数据库配置文件
* Created by PhpStorm.
* User: edwin
* Date: 2017/6/22
* Time: 19:44
*/
require 'db_config.php';
$mysqli = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME); //链接数据库
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error . '...');
exit();
} else {
printf("连接成功...");
$mysqli->set_charset("utf8");
// var_dump($mysqli->get_charset());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment