php - Set header HTTP code in Flightphp -


im developing api flightphp microframework , can't set http response code routes. can set , works perfectly:

header('http/1.0 500 error'); 

but want use native function http_response_code() php. 1 don't anything. want use because don't have manually type error message.

to return http response code using flight, can :

flight::route('get /', function(){     flight::json($data, $code = 500); });  

where "$data" variable leads array want send in json. if "$code" not set, default returned http response code "200". https://github.com/mikecao/flight/blob/master/flight/engine.php#l470


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -