diff --git a/despote/kernel/ErrCatch.php b/despote/kernel/ErrCatch.php index df50b4f..5418806 100644 --- a/despote/kernel/ErrCatch.php +++ b/despote/kernel/ErrCatch.php @@ -69,6 +69,13 @@ public function onException($exception) } } + /** + * 错误处理 + * @param Integer $errno 错误码 + * @param String $errstr 错误信息 + * @param String $errfile 发生错误的文件 + * @param Integger $errline 发生错误的行 + */ public function onError($errno, $errstr, $errfile, $errline) { $debug = Utils::config('error_catch', true); @@ -85,7 +92,6 @@ public function onError($errno, $errstr, $errfile, $errline) /** * 当程序停止运行时调用,尝试捕获错误 - * @return [type] [description] */ public function onShutdown() { @@ -105,7 +111,7 @@ public function onShutdown() * @param String $type 错误的类型,是 Error 还是 Exception * @param String $errstr 错误类型 * @param String $errfile 错误发生的文件的绝对路径 - * @param integer $errline 错误发生的行数 + * @param Integer $errline 错误发生的行数 */ private function display($type, $errstr, $errfile, $errline) { @@ -124,10 +130,10 @@ private function display($type, $errstr, $errfile, $errline) diff --git a/despote/kernel/File.php b/despote/kernel/File.php index 2f6558d..6aced1e 100644 --- a/despote/kernel/File.php +++ b/despote/kernel/File.php @@ -65,7 +65,7 @@ public function getLine($file, $line, $mode = 'rb') // 需要读取的文件内容 $content = []; // 初始化相关变量 - $startLine = $line[0] >= 0 ? $line[0] : 0; + $startLine = $line[0] >= 0 ? $line[0] : 1; $endLine = $line[count($line) - 1]; $count = $endLine - $startLine; diff --git a/todo b/todo index 4f2ea68..d068be6 100644 --- a/todo +++ b/todo @@ -1,4 +1,3 @@ -☐ 错误处理优化 ☐ XML 操作类根据属性或 XPath 获取结点 ☐ 图片操作类 ☐ 写文档 @@ -7,6 +6,7 @@ ___________________ Archive: + ✔ 错误处理优化 @done (2018-6-13 13:31:23) ✔ 特殊路由支持 @done (2018-6-12 18:59:30) ✔ 封装加密解密工具类 @done (2018-6-12 09:44:41) ✔ 增加常量配置校验 @done (2018-6-11 15:28:29)