Skip to content

Commit

Permalink
修复部分 BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
He110te4m committed Jun 13, 2018
1 parent 492b9d2 commit 7939b26
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions despote/kernel/ErrCatch.php
Expand Up @@ -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);
Expand All @@ -85,7 +92,6 @@ public function onError($errno, $errstr, $errfile, $errline)

/**
* 当程序停止运行时调用,尝试捕获错误
* @return [type] [description]
*/
public function onShutdown()
{
Expand All @@ -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)
{
Expand All @@ -124,10 +130,10 @@ private function display($type, $errstr, $errfile, $errline)
<ul style="list-style: none; padding: 5px 10px; margin: 0; font-size: 16px; background-color: #000; color: #fff;">
<li>Despote Framework [Version 3.0]. Copyright (c) 2017 He110. All rights reserved.</li>
<li>Copyright (c) 2017 He110. All rights reserved.</li>
<li style="color: green;">[root@He110 ~] $type Code :$code </li>
<li style="color: red;">[root@He110 ~] $type Info :$errstr </li>
<li style="color: blue;">[root@He110 ~] $type File :$errfile </li>
<li style="color: yellow;">[root@He110 ~] $type Line :$errline </li>
<li style="color: green;">[root@He110 ~] $type Code :<b>$code</b> </li>
<li style="color: red;">[root@He110 ~] $type Info :<b>$errstr</b> </li>
<li style="color: blue;">[root@He110 ~] $type File :<b>$errfile</b> </li>
<li style="color: yellow;">[root@He110 ~] $type Line :<b>$errline</b> </li>
<li>&nbsp;</li>
$trace
</ul>
Expand Down
2 changes: 1 addition & 1 deletion despote/kernel/File.php
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion todo
@@ -1,4 +1,3 @@
☐ 错误处理优化
☐ XML 操作类根据属性或 XPath 获取结点
☐ 图片操作类
☐ 写文档
Expand All @@ -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)
Expand Down

0 comments on commit 7939b26

Please sign in to comment.