This commit is contained in:
thinkphp
2015-12-20 10:34:26 +08:00
3 changed files with 11 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ namespace think\controller;
use think\Response; use think\Response;
abstract class rest abstract class Rest
{ {
protected $_method = ''; // 当前请求类型 protected $_method = ''; // 当前请求类型

View File

@@ -60,16 +60,20 @@ class Lang
public static function load($file, $range = '') public static function load($file, $range = '')
{ {
$range = $range ?: self::$range; $range = $range ?: self::$range;
$lang = is_file($file) ? include $file : [];
if (!isset(self::$lang[$range])) { if (!isset(self::$lang[$range])) {
self::$lang[$range] = []; self::$lang[$range] = [];
} }
// 批量定义 // 批量定义
if (!isset(self::$lang[$range])) { + if (is_string($file)) {
self::$lang[$range] = []; + $file = [$file];
+ }
+ $lang = [];
+ foreach ($file as $_file) {
+ $_lang = is_file($_file) ? include $_file : [];
+ $lang = array_merge($lang, array_change_key_case($_lang));
} }
if (!empty($lang)) { if (!empty($lang)) {
self::$lang[$range] = array_merge(self::$lang[$range], array_change_key_case($lang)); self::$lang[$range] = array_merge(self::$lang[$range], $lang);
} }
return self::$lang[$range]; return self::$lang[$range];
} }

View File

@@ -73,6 +73,7 @@ trait Query
$this->commit(); $this->commit();
} catch (\think\exception $e) { } catch (\think\exception $e) {
$this->rollback(); $this->rollback();
return false;
} }
return true; return true;
} }