0
У меня есть вопрос. У меня на следующие условия:Задайте ответ типа содержимого HTTP на «application/json» в php
You should return an HTTP 500 status code and more details about the error in the message body. Set the HTTP content type response to “application/json”.The error detail must be in JSON format as described below:
{
"ErrorCode" : 402,
"ErrorMessage" : "Item"
}
Я пытался так:
if(!Gain::verifyIfUserExistByIdm($aOutput['UserId'])){
header("HTTP/1.0 500 Internal Server Error");
return json_encode(array('ErrorCode'=>407,'ErrorMessage'=>'Error'));
die();
}
Но не работает, вы можете помочь мне, пожалуйста? Thx заранее
'заголовка ('Content-Type: приложение/json '); ' –
Где мне нужно добавить этот' header' – TanGio
Я думаю, что вы хотите это - http://stackoverflow.com/questions/4162223/how-to-send-500-internal-server-error-error -from-a-php-script, а возврат не требуется. просто выйти; после заголовка достаточно. – ArtisticPhoenix