Skip to content

Commit

Permalink
Update ZMConfig.php
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc authored Mar 21, 2022
1 parent 4b9c8f9 commit e502e87
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ZM/Config/ZMConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ public static function get($name, $key = null) {
if (isset(self::$config[$name])) $r = self::$config[$name];
else $r = self::loadConfig($name);
if ($r === false) return false;
if ($key !== null) return $r[$key] ?? null;
if ($key !== null) {
$levels = explode('.', $key);
foreach ($levels as $v) {
$r = $r[$v] ?? null;
if ($r === null) return null;
}
return $r ?? null;
}
else return $r;
}

Expand Down

0 comments on commit e502e87

Please sign in to comment.