im developing an API with FlightPHP microframework and I can't set an HTTP response code for my routes. I can set this and works perfectly:
header('HTTP/1.0 500 Error');
But I want use the native function http_response_code() from PHP. This one don't do anything. I want to use this because that I don't have to manually type the error message.
To return a HTTP response code using Flight, you can do it like this :
Where
$datais the variable that leads to the array you want to send in json. If$codeis not set, then the default returned HTTP response code is "200". https://github.com/mikecao/flight/blob/e25f023d4377a2b99b4be8bf7977f3fc0f8089c8/flight/Engine.php#L500