<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_46362"> <div class="blockcode"> <div id="code_O3z"><ol> <li> <li><?php<li>/* <li>* 来源: http://www.xuehuwang.com/ <li>* 作者: 雪狐博客 <li>* 应用: 用于处理配置数据<li>* 搜集整理:bbs.it-home.org<li>**/<li> final class Config { <li> private $data = array(); <li> <li> public function get($key) { <li> return (isset($this->data[$key]) ? $this->data[$key] : NULL); </li> <li> } </li> <li> </li> <li> public function set($key, $value) { </li> <li> $this->data[$key] = $value; </li> <li> } </li> <li> </li> <li> public function has($key) { </li> <li> return isset($this->data[$key]); </li> <li> } </li> <li> </li> <li> public function load($filename) { </li> <li> $file = DIR_CONFIG . $filename . '.php'; </li> <li> </li> <li> if (file_exists($file)) { </li> <li> $cfg = array(); </li> <li> </li> <li> require($file); </li> <li> </li> <li> $this->data = array_merge($this->data, $cfg); </li> <li> } else { </li> <li> exit('Error: Could not load config ' . $filename . '!'); </li> <li> } </li> <li> } </li> <li>}</li> </ol></div> <em onclick="copycode($('code_O3z'));">复制代码</em> </div> </td></tr></table> <div id="comment_46362" class="cm"> </div> <div id="post_rate_div_46362"></div> <br><br>