I am trying to understand a combination of three simple lines of php code. This is the code:
ob_end_clean(); header('HTTP/1.0 404 Not Found'); exit;
So, this is the code, and as I understand it, the first line is ob_end_clean (); . It can help, for example, using the specification (bytes). . So the first line is to prevent any previous exit.
The second header ('HTTP / 1.0 404 Not Found'); - heading.
And the third line exit completes the execution of the script.
If I delete the first line and I have the specification in the document, I get a blank page (No. 404).
If I delete the third line ( with and without specification ), I get a page on which I do not need a blank page, not 404.
- Mabye, if anyone can explain why I should use exit . 404
- Also why with the spec I don't get "headers have already sent an error"
Thank you all and have a nice day.
source share