This commit is contained in:
as2252258@163.com
2021-09-26 00:26:58 +08:00
parent 477de51126
commit b8b3221d51
3 changed files with 17 additions and 19 deletions
+3 -3
View File
@@ -102,10 +102,10 @@ abstract class Handler implements RequestHandlerInterface
if (!$interface->hasContentType()) {
$interface->withContentType('application/json;charset=utf-8');
}
if (is_object($responseData)) {
$responseData = get_object_vars($responseData);
}
if (str_contains($interface->getContentType(), 'xml')) {
if (is_object($responseData)) {
$responseData = get_object_vars($responseData);
}
$interface->getBody()->write(Help::toXml($responseData));
} else if (is_array($responseData)) {
$interface->getBody()->write(json_encode($responseData));