api response content header as json

This commit is contained in:
xinatorus 2020-05-22 20:11:52 +02:00
parent b036adf206
commit 0929870cc9

View File

@ -30,6 +30,7 @@ class ApiController {
} }
protected function response($data = [], $httpCode = '200'){ protected function response($data = [], $httpCode = '200'){
header('Content-Type: application/json');
http_response_code($httpCode); http_response_code($httpCode);
echo json_encode($data, JSON_UNESCAPED_UNICODE); echo json_encode($data, JSON_UNESCAPED_UNICODE);
} }