子奥 發表於 2023-12-14 00:00:00

dedecms织梦系统$GLOBALS定义文件在哪

<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        DedeCMS数据库的信息是写在data/common.inc.php,而系统连接数据库时使用的有一个函数是:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
        <div class="right">
                <span><u>复制代码</u></span>
</div>
        代码如下:</div>
<div class="msgborder" id="phpcode1" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
        <br>
        function Init($pconnect=FALSE) {<br>
        $this-&gt;linkID = 0; <br>
        $this-&gt;dbHost = $GLOBALS['cfg_dbhost']; //$GLOBALS在哪把信息放入$GLOBALS的? <br>
        $this-&gt;dbUser = $GLOBALS['cfg_dbuser']; <br>
        $this-&gt;dbPwd = $GLOBALS['cfg_dbpwd']; <br>
        $this-&gt;dbName = $GLOBALS['cfg_dbname']; <br>
        $this-&gt;dbPrefix = $GLOBALS['cfg_dbprefix']; <br>
        $this-&gt;result["me"] = 0; <br>
        $this-&gt;Open($pconnect);<br>
        }</div>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
         </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        它是在哪把信息放入$GLOBALS中的? </p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        回复:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
        $GLOBALS 是全局变量数组<br>
        凡是在函数和类以外定义的变量都在其中出现<br>
        比如 $GLOBALS['cfg_dbhost'] 就在 common.inc.php 中有 $cfg_dbhost = '~dbhost~';<br>
        当加载 common.inc.php 后就有 $GLOBALS['cfg_dbhost']</p>
頁: [1]
查看完整版本: dedecms织梦系统$GLOBALS定义文件在哪