Reputation: 69
I see somewhere people doing something like:
<?php
header('HTTP/1.0 200 OK');
header('HTTP/1.1 200 OK');
?>
What's the purpose of this? Seems the second one will always overwrite the first header? Or is this because if some clients doesn't support http 1.1 so they can still receive a 1.0 header?
Upvotes: 1
Views: 832
Reputation: 163528
There is no purpose to this. Only one HTTP status line can be sent to the client.
The default is to send 200 OK
anyway, so unless you're overriding a previous status line (which would be strange), then both lines are pointless.
If you are using PHP 5.4+, you should use http_response_code()
to set the status code anyway. Leave the protocol implementation up to the web server.
Upvotes: 2