简体   繁体   English

如何在 PhpStorm 中编辑 .env 文件?

[英]How to edit .env files in PhpStorm?

I generated new .env file with copy .env.example .env command in PhpStorm terminal.我在 PhpStorm 终端中使用copy .env.example .env命令生成了新的.env文件。 Then created .env file then but I can't edit in PhpStorm.然后创建 .env 文件,但我无法在 PhpStorm 中编辑。 When I double clicked it's open external editor (Notepad++).当我双击它打开外部编辑器(记事本++)。

不变的文件类型

  1. Settings/Preferences | Editor | File Types
  2. Find Files Opened in Associated Application entry in the top list 查找顶部列表中Files Opened in Associated Application
  3. Remove associated entry for .env files from the bottom list (Registered Patterns). 从底部列表(注册的模式)中删除.env文件的关联条目。
  4. Re-associate such pattern with another (more appropriate) File Type (eg "Text Files" .. or whatever other format that would be) 将这种模式与另一个(更合适的)文件类型(例如“文本文件” ..或其他可能的其他格式)重新关联

There is a plugin for .env files. 有一个.env文件的插件。 It also helps by autocompleting env() and getenv() functions. 它也可以通过自动完成env()和getenv()函数来提供帮助。 https://plugins.jetbrains.com/plugin/9525--env-files-support https://plugins.jetbrains.com/plugin/9525--env-files-support

Go to file -> settings -> Editor -> File Types -> Recognized file types and select the "Text" -> add some patterns转到文件 -> 设置 -> 编辑器 -> 文件类型 -> 识别的文件类型并选择“文本” -> 添加一些模式

.evn
*.env
.evn.*
*.env.*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM