drupal_set_header

Versions
4.6 – 6
drupal_set_header($header = NULL)

Set an HTTP response header for the current page.

▾ 6 functions call drupal_set_header()

aggregator_page_opml in modules/aggregator.module
Menu callback; generates an OPML representation of all feeds.
blogapi_rsd in modules/blogapi.module
drupal_access_denied in includes/common.inc
Generates a 403 error if the request is not allowed.
drupal_get_headers in includes/common.inc
Get the HTTP response headers for the current page.
drupal_not_found in includes/common.inc
Generates a 404 error if the request can not be handled.
node_feed in modules/node.module
A generic function for generating RSS feeds from a set of nodes.

Code

includes/common.inc, line 91

<?php
function drupal_set_header($header = NULL) {
  // We use an array to guarantee there are no leading or trailing delimiters.
  // Otherwise, header('') could get called when serving the page later, which
  // ends HTTP headers prematurely on some PHP versions.
  static $stored_headers = array();

  if (strlen($header)) {
    header($header);
    $stored_headers[] = $header;
  }
  return implode("\n", $stored_headers);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.