路由配置文件支持多个 使用 route_config_file 配置参数配置

This commit is contained in:
thinkphp
2016-08-06 17:08:58 +08:00
parent de4d8253da
commit 82103dee3a
3 changed files with 21 additions and 8 deletions

View File

@@ -33,9 +33,14 @@ class Route extends Command
protected function buildRouteCache()
{
$config = include CONF_PATH . 'route' . CONF_EXT;
if ($config) {
\think\Route::import($config);
$files = \think\Config::get('route_config_file');
foreach ($files as $file) {
if (is_file(CONF_PATH . $file . CONF_EXT)) {
$config = include CONF_PATH . $file . CONF_EXT;
if ($config) {
\think\Route::import($config);
}
}
}
$rules = \think\Route::rules(true);
array_walk_recursive($rules, [$this, 'buildClosure']);