示例#1
0
 /**
  * Connect to MySQL database
  */
 private function __construct()
 {
     // Database Authentication Credentials
     $credentials = DBCredentials::get_credentials();
     // MySQLi Constructor
     @parent::__construct($credentials['host'], $credentials['username'], $credentials['password'], $credentials['database']);
     @parent::set_charset('utf8');
     // Non-OO technique ensures compatability with some earlier versions of PHP5
     if (mysqli_connect_errno()) {
         die('Connection Error');
     }
 }