From 4957f3aaea6e1196699125d714b793d711672a59 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 20 Mar 2022 12:55:01 +0800 Subject: [PATCH] feat(web): db port --- web/app/.default-config.php | 3 ++- web/app/models/DB.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/app/.default-config.php b/web/app/.default-config.php index 974d264..599b1e3 100644 --- a/web/app/.default-config.php +++ b/web/app/.default-config.php @@ -12,7 +12,8 @@ return [ 'database' => 'app_uoj233', 'username' => 'root', 'password' => '_database_password_', - 'host' => '127.0.0.1' + 'host' => '127.0.0.1', + 'port' => '3306', ], 'web' => [ 'domain' => null, diff --git a/web/app/models/DB.php b/web/app/models/DB.php index a1b9c56..f696a6f 100644 --- a/web/app/models/DB.php +++ b/web/app/models/DB.php @@ -3,7 +3,7 @@ class DB { public static function init() { global $uojMySQL; - @$uojMySQL = mysqli_connect(UOJConfig::$data['database']['host'] . ':3306', UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']); + @$uojMySQL = mysqli_connect(UOJConfig::$data['database']['host'] . ':' . UOJConfig::$data['database']['port'], UOJConfig::$data['database']['username'], UOJConfig::$data['database']['password'], UOJConfig::$data['database']['database']); if (!$uojMySQL) { echo 'There is something wrong with database >_<.... ' . mysqli_connect_error(); die(); @@ -75,4 +75,4 @@ class DB { global $uojMySQL; return mysqli_affected_rows($uojMySQL); } -} \ No newline at end of file +}