久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php數(shù)據(jù)庫配置文件叫什么

      php數(shù)據(jù)庫配置文件叫什么

      在php代碼中創(chuàng)建數(shù)據(jù)庫配置文件。(推薦學習:PHP編程從入門到精通)

      將數(shù)據(jù)庫用戶名密碼等信息寫到配置文件config.php里,在需要引用配置文件內(nèi)容的文件里用include或require包含進來,并在函數(shù)里用global關鍵字將存放數(shù)據(jù)庫名,密碼等的變量全局化,這樣就可以在文件里的函數(shù)里使用了。

      1,config.php 數(shù)據(jù)庫配置文件:

      <?php $db_name="test"; $db_username="root"; global $db_password; ?>

      數(shù)據(jù)庫操作類(調(diào)用配置文件)db.fun.php:

      <?php require("config/config.php"); class db{ function fun(){ global $db_username,$db_password; echo "數(shù)據(jù)庫用戶名:".$db_username."<br />"; echo "數(shù)據(jù)庫密碼:".$db_password."<br />"; } } ?>

      應用文件test.php:

      <?php require("include/db.fun.php"); $a= new db(); $a->fun(); ?>

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號