I have added env file to my project developed in codeigniter 3
Actually i have placed my pace2.env file in htdocs folder and loaded the pace2.env file in htdocs/myproject/index.php file by using bellow lines
require './vendor/autoload.php';
use Dotenv\Dotenv;
use PHPUnit\Framework\TestCase;
$dotenv = new Dotenv('../', 'pace2.env');
$dotenv->load();
I am able to access $_ENV from my controller successfully. But while printing print_r($_ENV) in model it is showing empty array as Array()
I checked all the code but not found any relevant answer. Please help me fixing in this.
CodePudding user response:
Your env file is .env but you use
$dotenv = new Dotenv('../', 'pace2.env');
Possible it is root of problem?
CodePudding user response:
You should check you .env file name and change it to .env