From e6976918de9a3ad7c255f90b113bf02a92c57714 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 6 Oct 2016 20:18:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0yaml=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Config.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/think/Config.php b/library/think/Config.php index 5ab032fd..d7c3dc56 100644 --- a/library/think/Config.php +++ b/library/think/Config.php @@ -60,10 +60,12 @@ class Config } if (is_file($file)) { $type = pathinfo($file, PATHINFO_EXTENSION); - if ('php' != $type) { - return self::parse($file, $type, $name, $range); - } else { + if ('php' == $type) { return self::set(include $file, $name, $range); + } elseif ('yaml' == $type && function_exists('yaml_parse_file')) { + return self::set(yaml_parse_file($file), $name, $range); + } else { + return self::parse($file, $type, $name, $range); } } else { return self::$config[$range];