織夢dedecms數據庫的信息是寫在data/common.inc.php文件中的,而織夢在連接數據庫時使用的有一個函數是:
function Init($pconnect=FALSE) { $this->linkID = 0; $this->dbHost = $GLOBALS['cfg_dbhost']; $this->dbUser = $GLOBALS['cfg_dbuser']; $this->dbPwd = $GLOBALS['cfg_dbpwd']; $this->dbName = $GLOBALS['cfg_dbname']; $this->dbPrefix = $GLOBALS['cfg_dbprefix']; $this->result["me"] = 0; $this->Open($pconnect);}
里面的$GLOBALS是織夢的全局變量數組,凡是在函數和類以外定義的變量都在其中出現,比如$GLOBALS['cfg_dbhost']就在 common.inc.php中有$cfg_dbhost = '~dbhost~';
而當文件加載common.inc.php文件后就有$GLOBALS['cfg_dbhost']了。
新聞熱點
疑難解答