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

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -

php - Prepared Statement Inner Join Cannot Pass Parameter by Reference -

c# - Value cannot be null or empty.\r\nParameter name: name -