mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
使用 Response::send 取代 Response::returnData
This commit is contained in:
@@ -11,15 +11,13 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
class Error
|
||||
{
|
||||
class Error {
|
||||
/**
|
||||
* 自定义异常处理
|
||||
* @access public
|
||||
* @param mixed $e 异常对象
|
||||
*/
|
||||
public static function appException($e)
|
||||
{
|
||||
public static function appException($e) {
|
||||
$error = [
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
@@ -42,8 +40,7 @@ class Error
|
||||
* @param int $errline 错误行数
|
||||
* @return void
|
||||
*/
|
||||
public static function appError($errno, $errstr, $errfile, $errline)
|
||||
{
|
||||
public static function appError($errno, $errstr, $errfile, $errline) {
|
||||
$errorStr = "[{$errno}] {$errstr} {$errfile} 第 {$errline} 行.";
|
||||
switch ($errno) {
|
||||
case E_USER_ERROR:
|
||||
@@ -62,8 +59,7 @@ class Error
|
||||
* 应用关闭处理
|
||||
* @return void
|
||||
*/
|
||||
public static function appShutdown()
|
||||
{
|
||||
public static function appShutdown() {
|
||||
// 记录日志
|
||||
Log::save();
|
||||
if ($e = error_get_last()) {
|
||||
@@ -86,8 +82,7 @@ class Error
|
||||
* @param mixed $error 错误
|
||||
* @param int $code
|
||||
*/
|
||||
public static function halt($error, $code = 1)
|
||||
{
|
||||
public static function halt($error, $code = 1) {
|
||||
$message = is_array($error) ? $error['message'] : $error;
|
||||
$code = is_array($error) ? $error['code'] : $code;
|
||||
|
||||
@@ -127,7 +122,7 @@ class Error
|
||||
// 异常信息输出监听
|
||||
APP_HOOK && Hook::listen('error_output', $e);
|
||||
// 输出异常内容
|
||||
Response::returnData($e, $type);
|
||||
Response::send($e, $type);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user