From 4736fdd9799726bbc618b666bd215551c60b4f1f Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Tue, 24 Nov 2020 14:59:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E6=8A=A4=E7=94=A8=E6=88=B7=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E6=97=B6=E9=97=B4=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastphp/Fastphp.php | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/fastphp/Fastphp.php b/fastphp/Fastphp.php index 010a4d6..48a1880 100644 --- a/fastphp/Fastphp.php +++ b/fastphp/Fastphp.php @@ -139,24 +139,19 @@ class Fastphp global $is_script; $formal_origin = $this->config['formal_origin']; //跨域访问的时候才会存在此字段 $origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : ''; - // if (!in_array($origin, $formal_origin) && !$is_script) { - // 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']); - // } - 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']); + if (!in_array($origin, $formal_origin) && !$is_script) { + 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']); + } } //自动加载类