我想在 magento 的任何文件中获取 magento 的数据库配置。
我该怎么做呢?
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'];