wesmiler hace 5 años
padre
commit
ac159dbdd8
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      app/Exception/Handler/AppExceptionHandler.php

+ 4 - 1
app/Exception/Handler/AppExceptionHandler.php

@@ -44,7 +44,10 @@ class AppExceptionHandler extends ExceptionHandler
 
             // 阻止异常冒泡
             $this->stopPropagation();
-            return $response->withHeader('Server', 'Hyperf')->withStatus(401)->withBody(new SwooleStream($data));
+            return $response->withHeader('Server', 'Hyperf')
+                ->withHeader('charset','utf-8')
+                ->withStatus(401)
+                ->withBody(new SwooleStream($data));
         }
 
         $this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));