如何获得Magento的数据库信息[关闭](How to get magento database

2019-07-29 20:44发布

我想在Magento中的任何文件Magento的数据库配置。

我该怎么做呢?

Answer 1:

Magento的连接细节ü找到了以下方法..........

require_once ('../app/Mage.php');
$app = Mage::app('default');

$config  = Mage::getConfig()->getResourceConnectionConfig('default_setup');

$dbinfo = array('host' => $config->host,
            'user' => $config->username,
            'pass' => $config->password,
            'dbname' => $config->dbname
);

$hostname = $dbinfo['host'];
$user = $dbinfo['user'];
$password = $dbinfo['pass'];
$dbname = $dbinfo['dbname'];


文章来源: How to get magento database details [closed]
标签: php magento