Page 1 of 1
send same header twice?
Posted: Mon Sep 11, 2006 6:53 pm
by neophyte
Does anybody know of any consequences to the following in the same script?
Code: Select all
header('Content-type: image/jpeg');
header('Content-type: image/gif');
Does the effect depend on the browser or will the new header be over write the old one?
Posted: Mon Sep 11, 2006 6:55 pm
by Weirdan
if I remember correctly, the latter should replace the former. Check rfc2616 though.
Posted: Mon Sep 11, 2006 7:04 pm
by neophyte
From the php header manual:
The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type. For example:
That'll work in nicely with what I'm doing.
Posted: Mon Sep 11, 2006 9:08 pm
by Ambush Commander
Precisely. PHP automatically has buffering on for headers and sends them all at once at the first real page output.