Slim php API setStatus not working

I want to configure the http response header through the SLIM-php structure. For instance. using

$app->response->setStatus('403');

In my local apache2, it works fine, but when I put it in a live server, I always get it Status 200 OK.

On local I run php-5.4.6, but just php 5.3.28 can live there? I also access the API through an alternate domain of another provider. I tested a lot of things, and setting the header directly using the php function header()does not work. Does anyone know where there might be a glitch?

+4
source share
2 answers

According to Slim docs , use Integer to set the status.

, $app->response->setStatus(403); .

0

Request Response Slim, :

$app->response = $app->response->setStatus('403');
0

All Articles