laravel配置不同环境的配置文件
//在入口bootstrap/App.php中 $env = $app->detectEnvironment( function () use ($app) { $uname = php_uname('n'); $environment = 'local'; switch ($uname) { case 'xxx1': case 'xxx2': $environment = 'production'; break; case 'xxx3': $environment = 'testing'; break; default: $environment = 'local'; break; } putenv("APP_ENV={$environment}"); (new \Dotenv\Dotenv($app->basePath(), ".env.{$environment}"))->load(); } );