2016-03-16 18:55:15 1020 次浏览
$conf = include ("zip_data.conf.php"); if(!defined('ZIP_DATA_CONF')){ define('ZIP_DATA_CONF',json_encode($conf)); } function config($prop){ static $_conf = null; if(!$_conf){ $_conf = json_decode(ZIP_DATA_CONF,true); } if(is_string($prop)){ if(!strpos($prop,'.')){ return $_conf[$prop]; }else{ $names = explode('.',$prop); $val = $_conf[$names[0]]; $num = count($names); for($i = 1; $i < $num;$i ++){ $val = $val[$names[$i]]; } return $val; } }else{ return null; } }