基础配置与底层修改

This commit is contained in:
wanyongkang
2020-11-17 10:29:49 +08:00
parent cc1bce4672
commit c4720bc0f5

View File

@@ -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']);
}
}