微型php框架include/conf.class.php

成都创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于成都网站设计、网站制作、双滦网络推广、小程序制作、双滦网络营销、双滦企业策划、双滦品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联公司为所有大学生创业者提供双滦建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com

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,'
';

$conf->db = 'java0620';

echo $conf->db;

*/


当前题目:微型php框架include/conf.class.php
路径分享:http://myzitong.com/article/gihjds.html