if-modified-since请求标头drupal 7

时间:2017-12-05 17:36:06

标签: php drupal header drupal-7

我想在Drupal 7中为所有请求添加'If-modified-since'标头。 然后我需要在LastModi fi响应标题上响应304/200状态代码依赖。

我尝试通过hook_boot()实现它。但是这段代码不起作用:     function custom_views_hooks_boot() { // }

我使用x debag调试,结果证明函数内的代码甚至没有运行。

1 个答案:

答案 0 :(得分:0)

1 - 在DRUPAL_ROOT / includes中创建文件(例如:custom_bootstrap.inc)

2 - 编辑DRUPAL_ROOT / index.php

   <input ng-model="search"/>
   <table>
    <tr ng-repeat="p in people | filter:search|pFilter:transactions ">
    <td>{{$index +1}}. {{p.name}}: {{p.last_name}}</td>
   </tr>
   </table>

3 - 将你的东西放入custom_bootstrap.inc

require_once DRUPAL_ROOT . '/includes/custom_bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

4 - Optionnaly如果你需要一些drupal数据库功能,包括mini bootstrap:

header('If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT');
相关问题