diff --git a/lang/.gitignore b/lang/.gitignore deleted file mode 100644 index c96a04f0..00000000 --- a/lang/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file diff --git a/lang/zh-cn.php b/lang/zh-cn.php new file mode 100644 index 00000000..978adb56 --- /dev/null +++ b/lang/zh-cn.php @@ -0,0 +1,58 @@ + +// +---------------------------------------------------------------------- + +// 核心中文语言包 +return [ + // 系统错误提示 + 'Undefined variable' => '未定义变量', + 'Undefined index' => '未定义索引', + 'Parse error' => '语法解析错误', + 'Type error' => '类型错误', + 'Fatal error' => '致命错误', + + // 框架核心错误提示 + 'dispatch type not support' => '不支持的调度类型', + 'method param miss' => '方法参数错误', + 'method not exists' => '方法不存在', + 'module not exists' => '模块不存在', + 'class not exists' => '类不存在', + 'template not exists' => '模板文件不存在', + 'illegal controller name' => '非法的控制器名称', + 'illegal action name' => '非法的操作名称', + 'url suffix deny' => '禁止的URL后缀访问', + 'Route Not Found' => '当前访问路由未定义', + 'Underfined db type' => '未定义数据库类型', + 'variable type error' => '变量类型错误', + 'PSR-4 error' => 'PSR-4 规范错误', + 'not support total' => '简洁模式下不能获取数据总数', + 'not support last' => '简洁模式下不能获取最后一页', + 'error session handler' => '错误的SESSION处理器类', + 'not allow php tag' => '模板不允许使用PHP语法', + 'not support' => '不支持', + 'redisd master' => 'Redisd 主服务器错误', + 'redisd slave' => 'Redisd 从服务器错误', + 'must run at sae' => '必须在SAE运行', + 'memcache init error' => '未开通Memcache服务,请在SAE管理平台初始化Memcache服务', + 'KVDB init error' => '没有初始化KVDB,请在SAE管理平台初始化KVDB服务', + 'fields not exists' => '数据表字段不存在', + 'where express error' => '查询表达式错误', + 'no data to update' => '没有任何数据需要更新', + 'miss complex primary data' => '缺少复合主键数据', + 'miss update condition' => '缺少更新条件', + 'model data Not Found' => '模型数据不存在', + 'table data not Found' => '表数据不存在', + 'delete without condition' => '没有条件不会执行删除操作', + 'miss relation data' => '缺少关联表数据', + 'tag attr must' => '模板标签属性必须', + 'tag error' => '模板标签错误', + 'cache write error' => '缓存写入失败', + 'sae mc write error' => 'SAE mc 写入错误', +]; diff --git a/library/think/App.php b/library/think/App.php index 9a20883c..9a3dd8e6 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -249,7 +249,7 @@ class App // 初始化模块 $config = self::init($module); } else { - throw new HttpException(404, 'module [ ' . $module . ' ] not exists '); + throw new HttpException(404, 'module not exists:' . $module); } } else { // 单一模块部署 @@ -286,7 +286,7 @@ class App $action = $actionName . $config['action_suffix']; if (!preg_match('/^[A-Za-z](\w)*$/', $action)) { // 非法操作 - throw new \ReflectionException('illegal action name :' . $actionName); + throw new \ReflectionException('illegal action name:' . $actionName); } // 执行操作方法 @@ -301,7 +301,7 @@ class App $data = $method->invokeArgs($instance, [$action, '']); self::$debug && Log::record('[ RUN ] ' . $method->getFileName(), 'info'); } else { - throw new HttpException(404, 'method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists '); + throw new HttpException(404, 'method not exists:' . (new \ReflectionClass($instance))->getName() . '->' . $action); } } return $data; @@ -419,7 +419,7 @@ class App { // 检测URL禁用后缀 if ($config['url_deny_suffix'] && preg_match('/\.(' . $config['url_deny_suffix'] . ')$/i', $request->pathinfo())) { - throw new Exception('url suffix deny'); + throw new Exception('url suffix deny:'.$request->ext()); } $path = $request->path(); diff --git a/library/think/Db.php b/library/think/Db.php index ed44c659..be219898 100644 --- a/library/think/Db.php +++ b/library/think/Db.php @@ -65,7 +65,7 @@ class Db // 解析连接参数 支持数组和字符串 $options = self::parseConfig($config); if (empty($options['type'])) { - throw new \InvalidArgumentException('db type error'); + throw new \InvalidArgumentException('Underfined db type'); } $class = (!empty($options['namespace']) ? $options['namespace'] : '\\think\\db\\connector\\') . ucwords($options['type']); // 记录初始化信息 diff --git a/library/think/Input.php b/library/think/Input.php index c71ec0de..de287b14 100644 --- a/library/think/Input.php +++ b/library/think/Input.php @@ -474,7 +474,7 @@ class Input if (is_scalar($data)) { $data = (string) $data; } else { - throw new \InvalidArgumentException('变量类型不允许:' . gettype($data)); + throw new \InvalidArgumentException('variable type error:' . gettype($data)); } } } diff --git a/library/think/Lang.php b/library/think/Lang.php index fd606ba6..af763814 100644 --- a/library/think/Lang.php +++ b/library/think/Lang.php @@ -92,6 +92,19 @@ class Lang return self::$lang[$range]; } + /** + * 获取语言定义(不区分大小写) + * @param string|null $name 语言变量 + * @param array $vars 变量替换 + * @param string $range 语言作用域 + * @return mixed + */ + public static function has($name, $range = '') + { + $range = $range ?: self::$range; + return isset(self::$lang[$range][strtolower($name)]); + } + /** * 获取语言定义(不区分大小写) * @param string|null $name 语言变量 diff --git a/library/think/Loader.php b/library/think/Loader.php index df5b3cff..b1bb36ff 100644 --- a/library/think/Loader.php +++ b/library/think/Loader.php @@ -147,7 +147,7 @@ class Loader foreach ($map as $namespace => $path) { $length = strlen($namespace); if ('\\' !== $namespace[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + throw new \InvalidArgumentException("PSR-4 error: A non-empty PSR-4 prefix must end with a namespace separator."); } self::$prefixLengthsPsr4[$namespace[0]][$namespace] = $length; self::$prefixDirsPsr4[$namespace] = (array) $path; @@ -292,7 +292,7 @@ class Loader if (class_exists($class)) { $model = new $class(); } else { - throw new ClassNotFoundException('class [ ' . $class . ' ] not exists', $class); + throw new ClassNotFoundException('class not exists:' . $class, $class); } } self::$instance[$name . $layer] = $model; @@ -321,7 +321,7 @@ class Loader } elseif ($empty && class_exists($emptyClass = self::parseClass($module, $layer, $empty, $appendSuffix))) { return new $emptyClass(Request::instance()); } else { - throw new ClassNotFoundException('class [ ' . $class . ' ] not exists', $class); + throw new ClassNotFoundException('class not exists:' . $class, $class); } } @@ -357,7 +357,7 @@ class Loader if (class_exists($class)) { $validate = new $class; } else { - throw new ClassNotFoundException('class [ ' . $class . ' ] not exists', $class); + throw new ClassNotFoundException('class not exists:' . $class, $class); } } self::$instance[$name . $layer] = $validate; diff --git a/library/think/Paginator.php b/library/think/Paginator.php index ff243509..c37dc5aa 100644 --- a/library/think/Paginator.php +++ b/library/think/Paginator.php @@ -143,7 +143,7 @@ abstract class Paginator public function total() { if ($this->simple) { - throw new \DomainException('简洁模式下不能获取数据总数'); + throw new \DomainException('not support total'); } return $this->total; } @@ -161,7 +161,7 @@ abstract class Paginator public function lastPage() { if ($this->simple) { - throw new \DomainException('简洁模式下不能获取最后一页'); + throw new \DomainException('not support last'); } return $this->lastPage; } diff --git a/library/think/Response.php b/library/think/Response.php index 9dd67aa1..4f8eb0f5 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -123,7 +123,7 @@ class Response if (is_scalar($data)) { echo $data; } elseif (!is_null($data)) { - throw new \InvalidArgumentException('不支持的数据类型输出:' . gettype($data)); + throw new \InvalidArgumentException('variable type error:' . gettype($data)); } if (function_exists('fastcgi_finish_request')) { diff --git a/library/think/Session.php b/library/think/Session.php index 5bc2a856..d32b5ad9 100644 --- a/library/think/Session.php +++ b/library/think/Session.php @@ -95,7 +95,7 @@ class Session // 检查驱动类 if (!class_exists($class) || !session_set_save_handler(new $class($config))) { - throw new ClassNotFoundException('error session handler', $class); + throw new ClassNotFoundException('error session handler:' . $class, $class); } } if ($isDoStart) { diff --git a/library/think/Template.php b/library/think/Template.php index b1d6943b..36654aeb 100644 --- a/library/think/Template.php +++ b/library/think/Template.php @@ -1068,7 +1068,7 @@ class Template $this->includeFile[$template] = filemtime($template); return $template; } else { - throw new TemplateNotFoundException('template not exist:' . $template, $template); + throw new TemplateNotFoundException('template not exists:' . $template, $template); } } diff --git a/library/think/Validate.php b/library/think/Validate.php index 0eb1c8f7..02f4386e 100644 --- a/library/think/Validate.php +++ b/library/think/Validate.php @@ -1115,7 +1115,7 @@ class Validate if (method_exists($class, $method)) { return call_user_func_array([$class, $method], $params); } else { - throw new \BadMethodCallException(__CLASS__ . ':' . $method . ' method not exist'); + throw new \BadMethodCallException('method not exists:' . __CLASS__ . '->' . $method); } } } diff --git a/library/think/cache/driver/Apc.php b/library/think/cache/driver/Apc.php index 95b27d14..cd1ca3d7 100644 --- a/library/think/cache/driver/Apc.php +++ b/library/think/cache/driver/Apc.php @@ -36,7 +36,7 @@ class Apc public function __construct($options = []) { if (!function_exists('apc_cache_info')) { - throw new \BadFunctionCallException('not support Apc'); + throw new \BadFunctionCallException('not support: Apc'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Memcache.php b/library/think/cache/driver/Memcache.php index 981436fd..c93dd9f0 100644 --- a/library/think/cache/driver/Memcache.php +++ b/library/think/cache/driver/Memcache.php @@ -35,7 +35,7 @@ class Memcache public function __construct($options = []) { if (!extension_loaded('memcache')) { - throw new \BadFunctionCallException('not support memcache'); + throw new \BadFunctionCallException('not support: memcache'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Memcached.php b/library/think/cache/driver/Memcached.php index b19b0c0c..3e904f17 100644 --- a/library/think/cache/driver/Memcached.php +++ b/library/think/cache/driver/Memcached.php @@ -33,7 +33,7 @@ class Memcached public function __construct($options = []) { if (!extension_loaded('memcached')) { - throw new \BadFunctionCallException('not support memcached'); + throw new \BadFunctionCallException('not support: memcached'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Redis.php b/library/think/cache/driver/Redis.php index d872f5a7..b70ee77e 100644 --- a/library/think/cache/driver/Redis.php +++ b/library/think/cache/driver/Redis.php @@ -42,7 +42,7 @@ class Redis public function __construct($options = []) { if (!extension_loaded('redis')) { - throw new \BadFunctionCallException('not support redis'); + throw new \BadFunctionCallException('not support: redis'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Redisd.php b/library/think/cache/driver/Redisd.php index 0a424fb2..e3bc80e7 100644 --- a/library/think/cache/driver/Redisd.php +++ b/library/think/cache/driver/Redisd.php @@ -84,7 +84,7 @@ class Redisd public function __construct($options = []) { if (!extension_loaded('redis')) { - throw new \BadFunctionCallException('not support redis'); + throw new \BadFunctionCallException('not support: redis'); } $this->options = $options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Sae.php b/library/think/cache/driver/Sae.php index c1cdda77..c1526e51 100644 --- a/library/think/cache/driver/Sae.php +++ b/library/think/cache/driver/Sae.php @@ -38,11 +38,11 @@ class Sae public function __construct($options = []) { if (!function_exists('memcache_init')) { - throw new \BadFunctionCallException('请在SAE平台上运行代码。'); + throw new \BadFunctionCallException('must run at sae'); } $this->handler = memcache_init(); if (!$this->handler) { - throw new Exception('您未开通Memcache服务,请在SAE管理平台初始化Memcache服务'); + throw new Exception('memcache init error'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); @@ -113,7 +113,7 @@ class Sae if (!$kv) { $kv = new \SaeKV(); if (!$kv->init()) { - throw new Exception('您没有初始化KVDB,请在SAE管理平台初始化KVDB服务'); + throw new Exception('KVDB init error'); } } return $kv; diff --git a/library/think/cache/driver/Sqlite.php b/library/think/cache/driver/Sqlite.php index ac903fdc..11510a72 100644 --- a/library/think/cache/driver/Sqlite.php +++ b/library/think/cache/driver/Sqlite.php @@ -38,7 +38,7 @@ class Sqlite implements CacheInterface public function __construct($options = []) { if (!extension_loaded('sqlite')) { - throw new \BadFunctionCallException('not support sqlite'); + throw new \BadFunctionCallException('not support: sqlite'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Wincache.php b/library/think/cache/driver/Wincache.php index 0717ef05..cf7d509b 100644 --- a/library/think/cache/driver/Wincache.php +++ b/library/think/cache/driver/Wincache.php @@ -34,7 +34,7 @@ class Wincache public function __construct($options = []) { if (!function_exists('wincache_ucache_info')) { - throw new \BadFunctionCallException('not support WinCache'); + throw new \BadFunctionCallException('not support: WinCache'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/cache/driver/Xcache.php b/library/think/cache/driver/Xcache.php index 891e6212..0ddaa083 100644 --- a/library/think/cache/driver/Xcache.php +++ b/library/think/cache/driver/Xcache.php @@ -34,7 +34,7 @@ class Xcache public function __construct($options = []) { if (!function_exists('xcache_info')) { - throw new \BadFunctionCallException('not support Xcache'); + throw new \BadFunctionCallException('not support: Xcache'); } if (!empty($options)) { $this->options = array_merge($this->options, $options); diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index c3da93e0..4d94f237 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -94,7 +94,7 @@ abstract class Builder foreach ($data as $key => $val) { if (!in_array($key, $fields, true)) { if ($options['strict']) { - throw new Exception(' fields not exists :[' . $key . ']'); + throw new Exception('fields not exists:[' . $key . ']'); } } else { $item = $this->parseKey($key); @@ -611,7 +611,7 @@ abstract class Builder foreach ($data as $key => $val) { if (!in_array($key, $fields, true)) { if ($options['strict']) { - throw new Exception(' fields not exists :[' . $key . ']'); + throw new Exception('fields not exists:[' . $key . ']'); } unset($data[$key]); } elseif (is_scalar($val)) { diff --git a/library/think/db/Query.php b/library/think/db/Query.php index 36a49fac..7610c9c7 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -84,7 +84,7 @@ class Query $where[$name] = $args[0]; return $this->where($where)->value($args[1]); } else { - throw new Exception(__CLASS__ . ':' . $method . ' method not exist'); + throw new Exception('method not exist:' . __CLASS__ . '->' . $method); } } @@ -1672,7 +1672,7 @@ class Query $where[$field] = $data[$field]; } else { // 如果缺少复合主键数据则不执行 - throw new Exception('miss pk data'); + throw new Exception('miss complex primary data'); } unset($data[$field]); } @@ -1775,10 +1775,10 @@ class Query } } elseif (!empty($options['fail'])) { if(!empty($this->model)){ - throw new ModelNotFoundException('Data not Found', $this->model, $options); + throw new ModelNotFoundException('model data Not Found:' . $this->model , $this->model, $options); }else{ - throw new DataNotFoundException('Data not Found', $options['table'], $options); - } + throw new DataNotFoundException('table data not Found:' . $options['table'], $options['table'], $options); + } } return $resultSet; } @@ -1856,10 +1856,10 @@ class Query } } elseif (!empty($options['fail'])) { if(!empty($this->model)){ - throw new ModelNotFoundException('Data not Found', $this->model, $options); + throw new ModelNotFoundException('model data Not Found:' . $this->model , $this->model, $options); }else{ - throw new DataNotFoundException('Data not Found', $options['table'], $options); - } + throw new DataNotFoundException('table data not Found:' . $options['table'], $options['table'], $options); + } } else { $data = false; } @@ -1969,7 +1969,7 @@ class Query if (empty($options['where'])) { // 如果条件为空 不进行删除操作 除非设置 1=1 - throw new Exception('no data to delete without where'); + throw new Exception('delete without condition'); } // 生成删除SQL语句 $sql = $this->builder()->delete($options); diff --git a/library/think/exception/Handle.php b/library/think/exception/Handle.php index d6d112b6..a774ad6e 100644 --- a/library/think/exception/Handle.php +++ b/library/think/exception/Handle.php @@ -16,6 +16,7 @@ use think\App; use think\Config; use think\Console; use think\console\Output; +use think\Lang; use think\Log; use think\Response; @@ -40,14 +41,14 @@ class Handle $data = [ 'file' => $exception->getFile(), 'line' => $exception->getLine(), - 'message' => $exception->getMessage(), + 'message' => $this->getMessage($exception), 'code' => $this->getCode($exception), ]; $log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; } else { $data = [ - 'code' => $exception->getCode(), - 'message' => $exception->getMessage(), + 'code' => $this->getCode($exception), + 'message' => $this->getMessage($exception), ]; $log = "[{$data['code']}]{$data['message']}"; } @@ -121,7 +122,7 @@ class Handle 'name' => get_class($exception), 'file' => $exception->getFile(), 'line' => $exception->getLine(), - 'message' => $exception->getMessage(), + 'message' => $this->getMessage($exception), 'trace' => $exception->getTrace(), 'code' => $this->getCode($exception), 'source' => $this->getSourceCode($exception), @@ -140,8 +141,8 @@ class Handle } else { // 部署模式仅显示 Code 和 Message $data = [ - 'code' => $exception->getCode(), - 'message' => $exception->getMessage(), + 'code' => $this->getCode($exception), + 'message' => $this->getMessage($exception), ]; if (!Config::get('show_error_msg')) { @@ -189,6 +190,28 @@ class Handle return $code; } + /** + * 获取错误信息 + * ErrorException则使用错误级别作为错误编码 + * @param \Exception $exception + * @return string 错误信息 + */ + protected function getMessage(Exception $exception) + { + $message = $exception->getMessage(); + if (IS_CLI) { + return $message; + } + // 导入语言包 + Lang::load(THINK_PATH . 'lang' . DS . Lang::detect() . EXT); + if (strpos($message,':')) { + $name = strstr($message, ':', true); + return Lang::has($name) ? Lang::get($name) . ' ' . strstr($message, ':') : $message; + } else { + return Lang::has($message) ? Lang::get($message) : $message; + } + } + /** * 获取出错文件内容 * 获取错误的前9行和后9行 diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index f6cbecca..9ba06175 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -615,7 +615,7 @@ class Relation $query = clone $this->parent->db(); return $query->table($this->middle)->insert($pivot); } else { - throw new Exception(' miss relation data'); + throw new Exception('miss relation data'); } } @@ -680,7 +680,7 @@ class Relation } return call_user_func_array([$db, $method], $args); } else { - throw new Exception(__CLASS__ . ':' . $method . ' method not exist'); + throw new Exception('method not exists:' . __CLASS__ . '->' . $method); } } diff --git a/library/think/paginator/Collection.php b/library/think/paginator/Collection.php index 49bd59c0..64fbb93b 100644 --- a/library/think/paginator/Collection.php +++ b/library/think/paginator/Collection.php @@ -76,7 +76,7 @@ class Collection extends \think\Collection if ($this->paginator && method_exists($this->paginator, $method)) { return call_user_func_array([$this->paginator, $method], $args); } else { - throw new Exception(__CLASS__ . ':' . $method . ' method not exist'); + throw new Exception('method not exists:' . __CLASS__ . '->' . $method); } } } \ No newline at end of file diff --git a/library/think/session/driver/Memcache.php b/library/think/session/driver/Memcache.php index e3b0d1be..62792d78 100644 --- a/library/think/session/driver/Memcache.php +++ b/library/think/session/driver/Memcache.php @@ -41,7 +41,7 @@ class Memcache extends SessionHandler { // 检测php环境 if (!extension_loaded('memcache')) { - throw new Exception('_NOT_SUPPERT_:memcache'); + throw new Exception('not support:memcache'); } $this->handler = new \Memcache; // 支持集群 diff --git a/library/think/session/driver/Memcached.php b/library/think/session/driver/Memcached.php index a2dcfe7c..145e7ea0 100644 --- a/library/think/session/driver/Memcached.php +++ b/library/think/session/driver/Memcached.php @@ -42,7 +42,7 @@ class Memcached extends SessionHandler { // 检测php环境 if (!extension_loaded('memcached')) { - throw new Exception('_NOT_SUPPERT_:memcached'); + throw new Exception('not support:memcached'); } $this->handler = new \Memcached; // 设置连接超时时间(单位:毫秒) diff --git a/library/think/session/driver/Redis.php b/library/think/session/driver/Redis.php index 96389fe0..813199b7 100644 --- a/library/think/session/driver/Redis.php +++ b/library/think/session/driver/Redis.php @@ -42,7 +42,7 @@ class Redis extends SessionHandler { // 检测php环境 if (!extension_loaded('redis')) { - throw new Exception('_NOT_SUPPERT_:redis'); + throw new Exception('not support:redis'); } $this->handler = new \Redis; diff --git a/library/think/template/TagLib.php b/library/think/template/TagLib.php index 254407ea..51cb00d2 100644 --- a/library/think/template/TagLib.php +++ b/library/think/template/TagLib.php @@ -255,7 +255,7 @@ class TagLib $must = explode(',', $tag['must']); foreach ($must as $name) { if (!isset($result[$name])) { - throw new Exception('_PARAM_ERROR_:' . $name); + throw new Exception('tag attr must:' . $name); } } } @@ -272,7 +272,7 @@ class TagLib $result['expression'] = rtrim($result['expression'], '/'); $result['expression'] = trim($result['expression']); } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) { - throw new Exception('_XML_TAG_ERROR_:' . $name); + throw new Exception('tag error:' . $name); } } return $result; diff --git a/library/think/template/driver/File.php b/library/think/template/driver/File.php index bfb2787d..4ee86170 100644 --- a/library/think/template/driver/File.php +++ b/library/think/template/driver/File.php @@ -30,7 +30,7 @@ class File } // 生成模板缓存文件 if (false === file_put_contents($cacheFile, $content)) { - throw new Exception('cache write error :' . $cacheFile, 11602); + throw new Exception('cache write error:' . $cacheFile, 11602); } } diff --git a/library/think/template/driver/Sae.php b/library/think/template/driver/Sae.php index b1d18665..f6e2eb26 100644 --- a/library/think/template/driver/Sae.php +++ b/library/think/template/driver/Sae.php @@ -46,7 +46,7 @@ class Sae // 添加写入时间 $content = time() . $content; if (!$this->mc->set($cacheFile, $content, MEMCACHE_COMPRESSED, 0)) { - throw new Exception('sae mc write error :' . $cacheFile); + throw new Exception('sae mc write error:' . $cacheFile); } else { $this->contents[$cacheFile] = $content; return true; diff --git a/library/think/view/driver/Php.php b/library/think/view/driver/Php.php index f5866e8a..f522cce6 100644 --- a/library/think/view/driver/Php.php +++ b/library/think/view/driver/Php.php @@ -63,7 +63,7 @@ class Php } // 模板不存在 抛出异常 if (!is_file($template)) { - throw new TemplateNotFoundException('template file not exists:' . $template, $template); + throw new TemplateNotFoundException('template not exists:' . $template, $template); } // 记录视图信息 App::$debug && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]', 'info'); diff --git a/library/think/view/driver/Think.php b/library/think/view/driver/Think.php index 2a443aad..37f1d78b 100644 --- a/library/think/view/driver/Think.php +++ b/library/think/view/driver/Think.php @@ -73,7 +73,7 @@ class Think } // 模板不存在 抛出异常 if (!is_file($template)) { - throw new TemplateNotFoundException('template file not exists:' . $template, $template); + throw new TemplateNotFoundException('template not exists:' . $template, $template); } // 记录视图信息 App::$debug && Log::record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]', 'info'); diff --git a/library/traits/think/Instance.php b/library/traits/think/Instance.php index de123079..206a9412 100644 --- a/library/traits/think/Instance.php +++ b/library/traits/think/Instance.php @@ -39,7 +39,7 @@ trait Instance if (0 === strpos($method, '_') && is_callable([self::$instance, $call])) { return call_user_func_array([self::$instance, $call], $params); } else { - throw new Exception("not exists method:" . $method); + throw new Exception("method not exists:" . $method); } } }