cara memuat data dari file .env di php

// You can use symfony/dotenv. First install it with composer
// with this command: composer require phpmailer/phpmailer

// Then add this in your code:
use Symfony\Component\Dotenv\Dotenv;
require './vendor/autoload.php';

$dotenv = new Dotenv();
$dotenv->load(__DIR__.'/../.env'); // please update this path for your case

// You will get the variable both in
// $_ENV['ENVIRONMENT_VAR'] and $_SERVER['ENVIRONMENT_VAR'].
$password = $_SERVER['ENVIRONMENT_VAR'] ?? '';
Old Pizza