Rumah > Artikel > pembangunan bahagian belakang > 关于include文件赋值的有关问题
关于include文件赋值的问题
<br />include文件:<br /><?php <br /> $_CFG = array();<br /> $_CFG['DB_HOST'] = 'localhost';<br /> $_CFG['DB_USER'] = 'root';<br /> $_CFG['DB_PASWORD'] = 'liujianian';<br /> $_CFG['DB_NAME'] = 'commerceClub';<br />
<br /><?php<br /><br />class conf{<br /> protected static $ins = null;<br /> protected $data = array();<br /> final protected function _construct(){<br /> //一次性将配置文件读取进来<br /> include('./config.php');<br /> $this->data = $_CFG;<br /> }<br /> final protected function _clone(){<br /> <br /> }<br /> public static function getIns(){<br /> if(self::$ins instanceof self){<br /> return self::$ins;<br /> }else{<br /> self::$ins = new self();<br /> return self::$ins;<br /> }<br /> }<br />}<br />$conf = conf::getIns();<br />print_r($conf);<br />