From c4720bc0f5afbb1aa689b0f0203e01e4742badc9 Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Tue, 17 Nov 2020 10:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E9=85=8D=E7=BD=AE=E4=B8=8E?= =?UTF-8?q?=E5=BA=95=E5=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastphp/Fastphp.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fastphp/Fastphp.php b/fastphp/Fastphp.php index 7607324..e4d5114 100644 --- a/fastphp/Fastphp.php +++ b/fastphp/Fastphp.php @@ -138,18 +138,18 @@ class Fastphp { $formal_origin = $this->config['formal_origin']; //跨域访问的时候才会存在此字段 $origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : ''; - if (in_array($origin, $formal_origin)) { - define('DB_HOST', $this->config['formal_db']['host']); - define('DB_PORT', $this->config['formal_db']['port']); - define('DB_NAME', $this->config['formal_db']['dbname']); - define('DB_USER', $this->config['formal_db']['username']); - define('DB_PASS', $this->config['formal_db']['password']); - } else { + if (!in_array($origin, $formal_origin)) { define('DB_HOST', $this->config['db']['host']); define('DB_PORT', $this->config['db']['port']); define('DB_NAME', $this->config['db']['dbname']); define('DB_USER', $this->config['db']['username']); define('DB_PASS', $this->config['db']['password']); + } else { + define('DB_HOST', $this->config['formal_db']['host']); + define('DB_PORT', $this->config['formal_db']['port']); + define('DB_NAME', $this->config['formal_db']['dbname']); + define('DB_USER', $this->config['formal_db']['username']); + define('DB_PASS', $this->config['formal_db']['password']); } }