请问一下 Laravel 的 config 是怎么实现的?
最近正在研究 Laravel
源码,看到这里有点不太清楚是怎么实现的:这个是 Foundation/Boostrap/LoadConfiguration.php
这个文件的内容:
protected function getConfigurationFiles(Application $app)
{
$files = [];
$configPath = realpath($app->configPath());
foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
$directory = $this->getNestedDirectory($file, $configPath);
$files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
return $files;
}
执行到这里之后就会开始遍历,调用 config
目录的内容,但是具体怎么实现,一时半会还没有想清楚,所以希望有比较熟悉的朋友不吝赐教,多谢!
推荐文章: