How to send Server response in cakephp -


I have tried the following in the App Controller of the filter, it does not seem to be

  $ This- & gt; Feedback & gt; StatusCode (404);  

or

  header ('HTTP / 1.1 404 unauthorized', true, 404); Header ('HTTP / 1.1 404 not found');  

or

  throw the new NotFoundException ();  

If I debug the response, the status is shown as 404, but the HTTP status checker is always 200. I do not know why

the solution Found

  if (! Function_exists ('http_response_code')) {function http_response_code ($ newcode = NULL) {static $ code = 200; If ($ newcode! == faucet) {Header ('x-php-answer-code:'. $ New code, true, $ newcode); If (! Headers_sent ()) $ code = $ newcode; } return code; }}  


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -