如何为 laravel 生成 .env 文件?何为、文件、laravel、env

2023-09-06 16:02:05 作者:情何以堪

从 documentation 我看到可以创建一个 laravel 项目通过 laravel 安装程序:

From the documentation I see it's possible to create a laravel project via laravel installer:

$laravel new blog

或通过作曲家:

$composer create-project laravel/laravel --prefer-dist

如果我尝试第一种方法,则不会创建 .env 文件.如何让 laravel、artisan 或 composer 为我创建一个 .env 文件?

If I try the first way .env file is not created. How can I ask laravel,artisan or composer to create a .env file for me?

推荐答案

我遇到了项目中没有显示 .env 文件的问题.

I had this problem of no .env files showing up in the project.

原来我使用的 IDE(Netbeans,尽量不要判断)会显示某些类型的 .hidden 文件,但不是全部.

Turns out the IDE I was using (Netbeans, try not to judge) will show certain types of .hidden files but not all.

绞尽脑汁后,我检查了文件系统并找到了 .env + .env.example 文件/用文本编辑器修改了它们.

After racking my brains for a bit I checked the file system and found the .env + .env.example files / modified them with a text editor.

为像我这样使用狡猾的 IDE 的人留下这个答案.

Leaving this answer for the rare situation someones using a dodgy IDE like myself.