我想在magento中的任何文件中获取magento的数据库配置。
我该怎么做?
答案 0 :(得分:28)
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'];