L
L
LakeForest2021-04-24 16:49:04
PHP
LakeForest, 2021-04-24 16:49:04

I created a .env file in the root of the project, how can I make getenv return values ​​from .env?

I created a .env file in the root of the project, how can I make getenv return values ​​from .env?
I would like to solve the problem without additional libraries, such as Dotenv (or something like that).
Neither $_ENV['key'] nor getenv('key') currently work, meaning the methods don't return values.
Wednesday:
1. php 7.4
2. Windows 10
Later to run in docker.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-04-24
@vabka

Subsequently, to run in docker.

.env is only needed for development. In docker, you must also specify environment variables through ENV.
If you do not want to include third-party libraries, write your own function that will parse .env

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question