How to comment in laravel .env file?

2019-02-02 19:39发布

问题:

I am working on a project in Laravel where I am storing some settings in .env file setting like few parameters for testing purpose and few parameters are for live working so I was just checking that is there any way to comment in .env file of Laravel.

Here is an example

/* Test Settings */
ACCESS_KEY=qwsdr
ACCESS_TOKEN=Bgcvfsx

/* Live Settings */
ACCESS_KEY=985AsdefG
ACCCESS_TOKEN=LFP994kL

Thanks in Advance!

回答1:

You use hash commenting:

# Test Settings
ACCESS_KEY=qwsdr
ACCESS_TOKEN=Bgcvfsx

# Live Settings
ACCESS_KEY=985AsdefG
ACCCESS_TOKEN=LFP994kL

Documentation: https://github.com/vlucas/phpdotenv#comments



回答2:

#Database Connection 
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your db name
#DB_USERNAME=server username
#DB_PASSWORD=server password