cancel
Showing results for 
Search instead for 
Did you mean: 

how to Retrieve information from env.php to .phtml file

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

how to Retrieve information from env.php to .phtml file

hi guys, i need to fetch DB details from env.php to .phtml file .

is this possible ? can any one guide me.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: how to Retrieve information from env.php to .phtml file

Hello @bharath553

 

You can get the dataabase details by this code:

 

<?php
$envFilePath = __DIR__ . '/app/etc/env.php';
$configResult = include $envFilePath;
echo "<pre>";print_r($configResult);die;
?>

Manish Mittal
https://www.manishmittal.com/

View solution in original post

1 REPLY 1

Re: how to Retrieve information from env.php to .phtml file

Hello @bharath553

 

You can get the dataabase details by this code:

 

<?php
$envFilePath = __DIR__ . '/app/etc/env.php';
$configResult = include $envFilePath;
echo "<pre>";print_r($configResult);die;
?>

Manish Mittal
https://www.manishmittal.com/