src/Leevel/Option/Option.php
public function get(string $name = 'app\\', $defaults = null)
    {
        $name = $this->parseNamespace($name);
        $namespaces = $name[0];
        $name = $name[1];

        if ('*' === $name) {
            return $this->option[$namespaces];
        }

        if (!strpos($name, '.')) {
            return array_key_exists($name, $this->option[$namespaces]) ?
                $this->option[$namespaces][$name] :
                $defaults;
        }

        $parts = explode('.', $name);
        $option = $this->option[$namespaces];

        foreach ($parts as $part) {
            if (!isset($option[$part])) {
                return $defaults;
            }

            $option = $option[$part];
        }

        return $option;
    }
public function get(string $name = 'app\\', $defaults = null)
    {
        $name = $this->parseNamespace($name);
        $namespaces = $name[0];
        $name = $name[1];

        if ('*' === $name) {
            return $this->option[$namespaces];
        }

        if (!strpos($name, '.')) {
            return array_key_exists($name, $this->option[$namespaces]) ?
                $this->option[$namespaces][$name] :
                $defaults;
        }

        $parts = explode('.', $name);
        $option = $this->option[$namespaces];

        foreach ($parts as $part) {
            if (!isset($option[$part])) {
                return $defaults;
            }

            $option = $option[$part];
        }

        return $option;
    }
获取配置.

@param string $name
@param mixed  $defaults

@return mixed