From fde81c5f2b8324a09d6d1a8a62f2420c6f06c3b5 Mon Sep 17 00:00:00 2001 From: anfu Date: Fri, 13 Sep 2024 10:37:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=8A=A0=E8=BD=BD.e?= =?UTF-8?q?nv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Index.php | 4 +++- start.php | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controller/Index.php b/app/controller/Index.php index d5e3e7c..0241ce9 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -3,6 +3,7 @@ namespace app\controller; use think\Request; +use think\Env; class Index { @@ -22,7 +23,8 @@ class Index $file = request()->file('file'); $trueName = $file->getOriginalName(); - $serverIP = env('SERVER_ADDR', '192.168.1.161:8000'); + $env = new Env(); + $serverIP = $env->get('SERVER_ADDR', '192.168.1.65:8000'); // 组装保存路径 $savename = \think\facade\Filesystem::disk('upload')->putFile('upload', $file); diff --git a/start.php b/start.php index 509b10c..623987f 100644 --- a/start.php +++ b/start.php @@ -10,7 +10,6 @@ use think\Env; // 读取环境变量 $env = new Env(); -$env->load(__DIR__ . '/.env'); $serverAddr = $env->get('SERVER_ADDR', '192.168.1.161:8000'); $nacosAddr = $env->get('NACOS_ADDR', '192.168.1.105:8848');