PHP code example of nazares / phpdotenv
1. Go to this page and download the library: Download nazares/phpdotenv library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nazares / phpdotenv example snippets
$dotenv = new \nazares\phpdotenv\Dotenv($path);
$dotenv->load();
echo getenv('DB_HOST'); // localhost
echo $_ENV['DB_NAME']; // test
echo $_SERVER['DB_PASSWORD']; // secret
(new \nazares\phpdotenv\Dotenv($path))->load();
echo getenv('DB_HOST'); // localhost
echo $_ENV['DB_NAME']; // test
echo $_SERVER['DB_PASSWORD']; // secret