Commit 89bfbccb by 王召彬

Merge branch 'fixbug-cfgcenter' into test

parents 2bff67b5 017a99d2
...@@ -17,9 +17,26 @@ class CfgCenter ...@@ -17,9 +17,26 @@ class CfgCenter
* var_dump($cfgdata->Weapp->Region); // 输出:ap-shanghai * var_dump($cfgdata->Weapp->Region); // 输出:ap-shanghai
* *
* @param string $keyStr * @param string $keyStr
* @param string $default 默认返回值
* @param int $retype retype==1返回对象,retype==2返回数组
* @return mixed * @return mixed
*/ */
public static function get($keyStr) public static function get($keyStr, $default='', $retype=1)
{
$data = self::_get($keyStr);
if($data == '') {
return $default;
}
if($retype != 1) { // retype==1返回对象,retype==2返回数组
$dataArr = json_decode($data, true);
if(is_array($dataArr)) {
return $dataArr;
}
}
return $data;
}
private static function _get($keyStr)
{ {
$keyArr = self::parseKeyStr($keyStr); $keyArr = self::parseKeyStr($keyStr);
$rkey = implode(":", $keyArr); $rkey = implode(":", $keyArr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment