PHP returns the json format to specify the data type in the header: Content-Type:application/json, otherwise it will return by default: Content-Type:text/html;
example:
<?php
header('Content-Type:application/json; charset=utf-8');
$arr = [
'message' => 'success'
];
exit(json_encode($arr,256));
Return xml:
header('Content-Type:text/xml; charset=utf-8');