POST TIME:2018-03-17 12:13
DedeCMS數(shù)據(jù)庫的信息是寫在data/common.inc.php,而系統(tǒng)連接數(shù)據(jù)庫時使用的有一個函數(shù)是:
functionInit($pconnect=FALSE){
$this->linkID=0;
$this->dbHost=$GLOBALS['cfg_dbhost'];//$GLOBALS在哪把信息放入$GLOBALS的?
$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中的?
回復(fù):
$GLOBALS是全局變量數(shù)組
凡是在函數(shù)和類以外定義的變量都在其中出現(xiàn)
比如$GLOBALS['cfg_dbhost']就在common.inc.php中有$cfg_dbhost='~dbhost~';
當(dāng)加載common.inc.php后就有$GLOBALS['cfg_dbhost']