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');