From e752358bf6897e5b1d2a463fc89c99d424a68663 Mon Sep 17 00:00:00 2001 From: top_nuomi <1130395124@qq.com> Date: Thu, 29 Aug 2019 13:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E7=A9=BA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=97=AE=E9=A2=98=E3=80=81=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/library/Config.php | 14 ++++++++------ framework/library/Router.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/framework/library/Config.php b/framework/library/Config.php index ddfa0b3..b7633b2 100644 --- a/framework/library/Config.php +++ b/framework/library/Config.php @@ -57,12 +57,14 @@ class Config if (!isset(self::$files[$file])) { if (file_exists($file)) { $config = require $file; - // 合并配置项 - foreach ($config as $key => $value) { - if (array_key_exists($key, $this->config)) { - $this->config[$key] = array_merge($this->config[$key], $config[$key]); - } else { - $this->config[$key] = $value; + if (is_array($config) && !empty($config)) { + // 合并配置项 + foreach ($config as $key => $value) { + if (array_key_exists($key, $this->config)) { + $this->config[$key] = array_merge($this->config[$key], $config[$key]); + } else { + $this->config[$key] = $value; + } } } self::$files[$file] = true; diff --git a/framework/library/Router.php b/framework/library/Router.php index a2d7185..603c7df 100644 --- a/framework/library/Router.php +++ b/framework/library/Router.php @@ -76,7 +76,7 @@ class Router } // 检查方法在控制器中是否存在 if (!in_array($this->method, get_class_methods($this->class))) { - throw new RouteException('方法' . $this->action . '在控制器' . $this->ctrl . '中不存在'); + throw new RouteException('方法' . $this->method . '在控制器' . $this->ctrl . '中不存在'); } }