<?php
defined('ACC')||exit('Access Denied');
// 配置文件读取类
class conf {
protected static $ins = null;
protected $cfg = array('db'=>'java0620');
public static function getIns() {
if(self::$ins === null) {
self::$ins = new self();
}
return self::$ins;
}
final protected function __construct() {
require(ROOT . 'include/config.php');
$this->cfg = $cfg;
}
// 根据指定的配置项,返回该配置项的值
public function __get($k) {
if(!isset($this->cfg[$k])) {
return null;
}
return $this->cfg[$k];
}
// 根据指定的配置项,返回配置项的值
public function __set($k,$v) {
$this->cfg[$k] = $v;
}
}
/*
$conf = conf::getIns();
echo $conf->db,'<br />';
$conf->db = 'java0620';
echo $conf->db;
*/
共同學(xué)習(xí),寫(xiě)下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
100積分直接送
付費(fèi)專(zhuān)欄免費(fèi)學(xué)
大額優(yōu)惠券免費(fèi)領(lǐng)