lundi 20 juin 2016

How to access env file from the root of the Laravel Project?

I have a php script locate at the root directory of my laravel project. I want to access my settings in my .env


I've tried

$dbname      = env('DB_DATABASE');
$user        = env('DB_USERNAME');
$host        = env('DB_HOST');
$pass        = env('DB_PASSWORD');


I got

PHP Fatal error:  Call to undefined function env()


What is the workaround for that ? Should I include anything to be able to access env()?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire