API'mde bazı şeyler kötü giderse, bir http 500 isteği vermek istiyorum.İnce çerçeve ile http 500 dönüş
$app = new Slim();
$app->halt(500);
ben bu kodu çalıştırırsanız Hala http 200
dönmek
:
$status = $app->response()->status();
echo $status; //Here it is 200
$status = $app->response()->status(500);
echo $status; //Here it is 500
bir HTTP 200
$ app = new Slim(); \t \t $ app-> response() -> status (500); \t \t $ app-> run(); Hala kemanda bir http 200 döndürür, ancak web görünümü artık 404'tür. Neden? – rubin
HTTPLiveHeaders veya Firebug veya Chrome Dev Tools (F12) kullanarak yanıt kodunu kontrol edin. – MrCode
Kemancıda ve Firebug'da http 200'ü döndürür. – rubin