From 3c517a0609d34e454d67666f4e5cc4f1876c6397 Mon Sep 17 00:00:00 2001 From: F4NNIU Date: Sun, 12 Nov 2017 22:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=BB=8E=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=8F=98=E9=87=8F=20env=20=E4=B8=AD=E8=8E=B7=E5=BE=97=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/database.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/application/database.php b/application/database.php index 18fa94c63..d1bbd61c8 100755 --- a/application/database.php +++ b/application/database.php @@ -10,29 +10,31 @@ // | Author: liu21st // +---------------------------------------------------------------------- +use think\Env; + return [ // 数据库类型 - 'type' => 'mysql', + 'type' => Env::get('database.type', 'mysql'), // 服务器地址 - 'hostname' => '127.0.0.1', + 'hostname' => Env::get('database.hostname', '127.0.0.1'), // 数据库名 - 'database' => 'fastadmin', + 'database' => Env::get('database.database', 'fastadmin'), // 用户名 - 'username' => 'root', + 'username' => Env::get('database.username', 'root'), // 密码 - 'password' => '', + 'password' => Env::get('database.password', ''), // 端口 - 'hostport' => '', + 'hostport' => Env::get('database.hostport', ''), // 连接dsn 'dsn' => '', // 数据库连接参数 'params' => [], // 数据库编码默认采用utf8 - 'charset' => 'utf8', + 'charset' => Env::get('database.charset', 'utf8'), // 数据库表前缀 - 'prefix' => 'fa_', + 'prefix' => Env::get('database.prefix', 'fa_'), // 数据库调试模式 - 'debug' => true, + 'debug' => Env::get('database.debug', true), // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) 'deploy' => 0, // 数据库读写是否分离 主从式有效 -- Gitee