We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
版本:1.2.3 文件:src/Support/Collection.php PHP版本:8.1 问题描述: 一个形如:
$config = new Collection([ 'a' => 'a0', 'b' => [ 'b1' => 'b10' ] ]); var_dump($config->get('b.b1')); //result is "null"
原因:
/** * @param array $array * @param string $key * @param mixed|null $default * * @return mixed */ public function dotGet($array, $key, $default = null) { if (is_null($key)) { return $array; } if (array_key_exists($key, $array)) { return $array[$key]; } foreach (explode('.', $key) as $segment) { if (array_key_exists($segment, $array)) { $array = $array[$segment]; } else { return $default; } } // 缺少循环完的返回 return $array; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
版本:1.2.3
文件:src/Support/Collection.php
PHP版本:8.1
问题描述:
一个形如:
原因:
The text was updated successfully, but these errors were encountered: