Drupal启动阶段之六:页面头信息

Drupal在本阶段为用户设置缓存头信息。Drupal不为验证用户缓存页面,每次请求时都是从新读取的。

function _drupal_bootstrap_page_header() {
  bootstrap_invoke_all('boot'); // 调用boot钩子, 只是启动模块

  if (!drupal_is_cli()) {
    ob_start();
    drupal_page_header();
  }
}

function drupal_page_header() {
  $headers_sent = &drupal_static(__FUNCTION__, FALSE);
  if ($headers_sent) {
    return TRUE;
  }
  $headers_sent = TRUE;

  $default_headers = array(
    'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT',
    'Last-Modified' => gmdate(DATE_RFC1123, REQUEST_TIME),
    'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0',
    'ETag' => '"' . REQUEST_TIME . '"',
  );
  drupal_send_headers($default_headers);
}
原文地址:https://www.cnblogs.com/eastson/p/3380321.html