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


PHP HTTP::Date方法代码示例

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


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

示例1: http_date_string

function http_date_string()
{
    $result = FALSE;
    if (class_exists('HTTP')) {
        $result = HTTP::Date(time());
    }
    return $result;
}
开发者ID:ronniebrito,项目名称:moodle_moviemasher,代码行数:8,代码来源:dateutils.php

示例2: getHeadersAsString

 public function getHeadersAsString()
 {
     $text = sprintf("HTTP/%s %s %s" . self::CRLF, $this->version, $this->code, self::resolveStatusCode($this->code));
     $this->setHeader(self::DATE, HTTP::Date(time()));
     if ($this->body && !$this->existsHeader('Content-Type')) {
         $this->setContentType('text/html;charset=UTF-8');
     }
     $text .= parent::getHeadersAsString() . self::CRLF;
     return $text;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:10,代码来源:Response.class.php

示例3: toString

 public function toString()
 {
     $out = $this->name . '=' . urldecode($this->value);
     if ($this->expire !== null) {
         $out .= '; expires=' . HTTP::Date($this->expire);
     }
     if ($this->path !== null) {
         $out .= '; path=' . $this->path;
     }
     if ($this->domain !== null) {
         $out .= '; domain=' . urlencode($this->domain);
     }
     if ($this->secure === true) {
         $out .= '; secure';
     }
     return $out;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:17,代码来源:Cookie.class.php

示例4: setHeader

 /**
  * Set Header
  * 
  * The default value for the Last-Modified header will be current
  * date and atime if $value is omitted.
  * 
  * @access  public
  * @return  bool    Returns true on success or false if $key was empty or
  *                  $value was not of an scalar type.
  * @param   string  $key The name of the header.
  * @param   string  $value The value of the header. (NULL to unset header)
  */
 function setHeader($key, $value = null)
 {
     if (empty($key) || isset($value) && !is_scalar($value)) {
         return false;
     }
     $key = strToLower($key);
     if ($key == 'last-modified') {
         if (!isset($value)) {
             $value = HTTP::Date(time());
         } elseif (is_numeric($value)) {
             $value = HTTP::Date($value);
         }
     }
     if (isset($value)) {
         $this->_headers[$key] = $value;
     } else {
         unset($this->_headers[$key]);
     }
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:posemuckel-svn,代码行数:32,代码来源:Header.php

示例5: testpost

 function testpost()
 {
     require_once 'HTTP/Request.php';
     $r =& new HTTP_Request($this->testScript);
     $r->setMethod(HTTP_REQUEST_METHOD_GET);
     $r->sendRequest();
     $lm = $r->getResponseHeader('last-modified');
     $r->setMethod(HTTP_REQUEST_METHOD_POST);
     $r->sendRequest();
     $this->assertEquals(200, $r->getResponseCode(), 'HTTP 200 Ok (POST without If-Modified-Since)');
     $r->addHeader('If-Modified-Since', HTTP::Date(strtotime('yesterday')));
     $r->sendRequest();
     $this->assertEquals(200, $r->getResponseCode(), 'HTTP 200 Ok (POST with If-Modified-Since == yesterday)');
     $r->addHeader('If-Modified-Since', HTTP::Date(time() - 3));
     $r->sendRequest();
     $this->assertEquals(200, $r->getResponseCode(), 'HTTP 200 Ok (POST with If-Modified-Since == now)');
     $r->addHeader('If-Modified-Since', HTTP::Date($lm));
     sleep(3);
     $r->sendRequest();
     $this->assertEquals(200, $r->getResponseCode(), 'HTTP 200 Ok (POST with If-Modified-Since == Last-Modified)');
     $this->assertEquals(HTTP::Date(), $r->getResponseHeader('last-modified'), 'POST time() == Last-Modified');
     unset($r);
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:23,代码来源:header_cache.php

示例6: setLastModified

 /**
  * Set "Last-Modified"
  *
  * This is usually determined by filemtime() in HTTP_Download::setFile()
  * If you set raw data for download with HTTP_Download::setData() and you
  * want do send an appropiate "Last-Modified" header, you should call this
  * method.
  * 
  * @access  public
  * @return  void
  * @param   int     unix timestamp
  */
 function setLastModified($last_modified)
 {
     $this->lastModified = HTTP::Date((int) $last_modified);
     $this->headers['Last-Modified'] = (int) $last_modified;
 }
开发者ID:BackupTheBerlios,项目名称:smart-svn,代码行数:17,代码来源:Download.php

示例7: testdateToTimestamp

 function testdateToTimestamp()
 {
     $h =& new HTTP_Header();
     $this->assertEquals(strtotime($d = HTTP::Date()), $h->dateToTimestamp($d));
     unset($h);
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:6,代码来源:header.php


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