修复项目空配置问题、路由错误提示

This commit is contained in:
TOP糯米 2019-08-29 13:41:33 +08:00
parent 4e70ddd22d
commit e752358bf6
2 changed files with 9 additions and 7 deletions

View File

@ -57,6 +57,7 @@ class Config
if (!isset(self::$files[$file])) { if (!isset(self::$files[$file])) {
if (file_exists($file)) { if (file_exists($file)) {
$config = require $file; $config = require $file;
if (is_array($config) && !empty($config)) {
// 合并配置项 // 合并配置项
foreach ($config as $key => $value) { foreach ($config as $key => $value) {
if (array_key_exists($key, $this->config)) { if (array_key_exists($key, $this->config)) {
@ -65,6 +66,7 @@ class Config
$this->config[$key] = $value; $this->config[$key] = $value;
} }
} }
}
self::$files[$file] = true; self::$files[$file] = true;
} }
} }

View File

@ -76,7 +76,7 @@ class Router
} }
// 检查方法在控制器中是否存在 // 检查方法在控制器中是否存在
if (!in_array($this->method, get_class_methods($this->class))) { if (!in_array($this->method, get_class_methods($this->class))) {
throw new RouteException('方法' . $this->action . '在控制器' . $this->ctrl . '中不存在'); throw new RouteException('方法' . $this->method . '在控制器' . $this->ctrl . '中不存在');
} }
} }