当前位置: 首页>>代码示例>>PHP>>正文


PHP SS_HTTPResponse::removeHeader方法代码示例

本文整理汇总了PHP中SS_HTTPResponse::removeHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP SS_HTTPResponse::removeHeader方法的具体用法?PHP SS_HTTPResponse::removeHeader怎么用?PHP SS_HTTPResponse::removeHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SS_HTTPResponse的用法示例。


在下文中一共展示了SS_HTTPResponse::removeHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ok

 protected function ok(array $res = null, $use_etag = true)
 {
     $response = new SS_HTTPResponse();
     $response->setStatusCode(200);
     $response->addHeader('Content-Type', 'application/json');
     if (is_null($res)) {
         $res = array();
     }
     $response->setBody(json_encode($res));
     //conditional get Request (etags)
     $request = Controller::curr()->getRequest();
     if ($request->isGET() && $use_etag) {
         $etag = md5($response->getBody());
         $requestETag = $request->getHeader('If-None-Match');
         foreach (array('Expires', 'Cache-Control') as $header) {
             $response->removeHeader($header);
         }
         $lastmod = gmdate('D, d M Y 0:0:0 \\G\\M\\T', time());
         $response->addHeader('Cache-Control', 'max-age=3600');
         $response->addHeader('Last-Modified', $lastmod);
         $response->addHeader('Expires', gmdate('D, d M Y H:m:i \\G\\M\\T', time() + 3600));
         $response->addHeader('ETag', $etag);
         if (!empty($requestETag) && $requestETag == $etag) {
             $response->setStatusCode(304);
             $response->addHeader('ETag', $etag);
             $response->setBody(null);
         }
     }
     return $response;
 }
开发者ID:OpenStackweb,项目名称:openstack-org,代码行数:30,代码来源:RestfulJsonApiResponses.php

示例2: applyToResponse

 /**
  * @param Object $originator
  * @param SS_HTTPRequest $request
  * @param SS_HTTPResponse $response
  * @param DataModel $model
  */
 public function applyToResponse($originator, SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model)
 {
     foreach ($this->headers as $key => $value) {
         if ($value !== "") {
             $response->addHeader($key, $value);
         } else {
             $response->removeHeader($key);
         }
     }
 }
开发者ID:mateusz,项目名称:controllerpolicy,代码行数:16,代码来源:CustomHeaderPolicy.php

示例3: ok

 protected function ok(array $res = null)
 {
     $response = new SS_HTTPResponse();
     $response->setStatusCode(200);
     $response->addHeader('Content-Type', 'application/json');
     if (is_null($res)) {
         $res = array();
     }
     $response->setBody(json_encode($res));
     //conditional get Request (etags)
     $request = Controller::curr()->getRequest();
     if ($request->isGET()) {
         $etag = md5($response->getBody());
         $requestETag = $request->getHeader('If-None-Match');
         if (!empty($requestETag) && $requestETag == $etag) {
             $response->setStatusCode(304);
             foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) {
                 $response->removeHeader($header);
             }
             $response->setBody(null);
         } else {
             $response->addHeader('ETag', $etag);
         }
     }
     return $response;
 }
开发者ID:rbowen,项目名称:openstack-org,代码行数:26,代码来源:Page.php


注:本文中的SS_HTTPResponse::removeHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。