默认不加载.env

This commit is contained in:
小王 2024-09-13 10:37:11 +08:00
parent 6446be3a2f
commit fde81c5f2b
2 changed files with 3 additions and 2 deletions

View File

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

View File

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