On Sun, 2008-03-30 at 16:05 -0400, Edward Z. Yang wrote:
> Christian Schmidt wrote:
> > What do you think of the general idea of being able to unset
> headers?
> > And what do you think of my patch?
>
> If you need this kind of flexibility, I recommend you make an
> HttpHeaders class which manages these things and then sends them when
> necessary.
>
That's what I do. All you need is some simple functions:
$headers = array();
addHeader($name, $value) {
global $headers;
$headers[$name] = $value;
return true;
}
deleteHeader($name) {
global $headers;
if (array_key_exists($name, $headers)) {
unset($headers[$name]);
}
return true;
}
sendHeaders() {
global $headers;
foreach ($headers as $name => $value) {
header($name . ': ' . $value);
}
return true;
}
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php