本文整理汇总了PHP中gmdate函数的典型用法代码示例。如果您正苦于以下问题:PHP gmdate函数的具体用法?PHP gmdate怎么用?PHP gmdate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gmdate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
function export()
{
global $mainframe;
$model = $this->getModel('attendees');
$datas = $model->getData();
header('Content-Type: text/x-csv');
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Disposition: attachment; filename=attendees.csv');
header('Pragma: no-cache');
$k = 0;
$export = '';
$col = array();
for ($i = 0, $n = count($datas); $i < $n; $i++) {
$data =& $datas[$i];
$col[] = str_replace("\"", "\"\"", $data->name);
$col[] = str_replace("\"", "\"\"", $data->username);
$col[] = str_replace("\"", "\"\"", $data->email);
$col[] = str_replace("\"", "\"\"", JHTML::Date($data->uregdate, JText::_('DATE_FORMAT_LC2')));
$col[] = str_replace("\"", "\"\"", $data->uid);
for ($j = 0; $j < count($col); $j++) {
$export .= "\"" . $col[$j] . "\"";
if ($j != count($col) - 1) {
$export .= ";";
}
}
$export .= "\r\n";
$col = '';
$k = 1 - $k;
}
echo $export;
$mainframe->close();
}
示例2: __toString
/**
* Returns the cookie as a string.
*
* @return string The cookie
*/
public function __toString()
{
$str = urlencode($this->getName()) . '=';
if ('' === (string) $this->getValue()) {
$str .= 'deleted; expires=' . gmdate('D, d-M-Y H:i:s T', time() - 31536001);
} else {
$str .= urlencode($this->getValue());
if ($this->getExpiresTime() !== 0) {
$str .= '; expires=' . gmdate('D, d-M-Y H:i:s T', $this->getExpiresTime());
}
}
if ($this->path) {
$str .= '; path=' . $this->path;
}
if ($this->getDomain()) {
$str .= '; domain=' . $this->getDomain();
}
if (true === $this->isSecure()) {
$str .= '; secure';
}
if (true === $this->isHttpOnly()) {
$str .= '; httponly';
}
return $str;
}
示例3: transfer
/**
* {@inheritdoc}
*/
protected function transfer()
{
while (!$this->stopped && !$this->source->isConsumed()) {
if ($this->source->getContentLength() && $this->source->isSeekable()) {
// If the stream is seekable and the Content-Length known, then stream from the data source
$body = new ReadLimitEntityBody($this->source, $this->partSize, $this->source->ftell());
} else {
// We need to read the data source into a temporary buffer before streaming
$body = EntityBody::factory();
while ($body->getContentLength() < $this->partSize && $body->write($this->source->read(max(1, min(10 * Size::KB, $this->partSize - $body->getContentLength()))))) {
}
}
// @codeCoverageIgnoreStart
if ($body->getContentLength() == 0) {
break;
}
// @codeCoverageIgnoreEnd
$params = $this->state->getUploadId()->toParams();
$command = $this->client->getCommand('UploadPart', array_replace($params, array('PartNumber' => count($this->state) + 1, 'Body' => $body, 'ContentMD5' => (bool) $this->options['part_md5'], Ua::OPTION => Ua::MULTIPART_UPLOAD)));
// Notify observers that the part is about to be uploaded
$eventData = $this->getEventData();
$eventData['command'] = $command;
$this->dispatch(self::BEFORE_PART_UPLOAD, $eventData);
// Allow listeners to stop the transfer if needed
if ($this->stopped) {
break;
}
$response = $command->getResponse();
$this->state->addPart(UploadPart::fromArray(array('PartNumber' => count($this->state) + 1, 'ETag' => $response->getHeader('ETag', true), 'Size' => $body->getContentLength(), 'LastModified' => gmdate(DateFormat::RFC2822))));
// Notify observers that the part was uploaded
$this->dispatch(self::AFTER_PART_UPLOAD, $eventData);
}
}
示例4: seconds
/**
* Formats a second into years, months, days, hours, minutes, seconds.
*
* Example:
* format::seconds(65) returns "1 minute, 5 seconds"
*
* @param int number of seconds
* @return string formatted seconds
*/
public static function seconds($seconds)
{
list($years, $months, $days, $hours, $minutes, $seconds) = explode(":", gmdate("Y:n:j:G:i:s", $seconds));
$years -= 1970;
$months--;
$days--;
$parts = array();
if ($years > 0) {
$parts[] = $years . " " . str::plural("year", $years);
}
if ($months > 0) {
$parts[] = $months . " " . str::plural("month", $months);
}
if ($days > 0) {
$parts[] = $days . " " . str::plural("day", $days);
}
if ($hours > 0) {
$parts[] = $hours . " " . str::plural("hour", $hours);
}
if ($minutes > 0) {
$parts[] = sprintf("%d", $minutes) . " " . str::plural("minute", $minutes);
}
if ($seconds > 0) {
$parts[] = sprintf("%d", $seconds) . " " . str::plural("second", $seconds);
}
return implode(", ", $parts);
}
示例5: httpNoCache
function httpNoCache()
{
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
}
示例6: afterFind
public function afterFind()
{
$this->cost = number_format($this->cost / 100, 2, '.', ',');
$this->timestamp = gmdate('dS-M-Y', $this->timestamp);
$this->service_status = $this->service_status === '1' ? "Active" : "Inactive";
return parent::afterFind();
}
示例7: action_index
public function action_index()
{
header("Last-Modified: " . gmdate('D, d M Y H:i:s T'));
header("Expires: " . gmdate('D, d M Y H:i:s T', time() + 315360000));
header("Cache-Control: max-age=315360000");
header('Content-Type: text/cache-manifest; charset=utf-8');
//header("HTTP/1.1 304 Not Modified");
$version = date('Y-m-d H:i:s');
echo <<<EOF
CACHE MANIFEST
# VERSION {$version}
# 直接缓存的文件
CACHE:
/media/MDicons/css/MDicon.min.css
/media/mdl/material.cyan-red.min.css
/media/mdl/material.min.js
/media/sidebarjs/sidebarjs.css
/media/css/weui.min.css
/media/js/jquery.min.js
/media/sidebarjs/sidebarjs.js
/media/MDicons/fonts/mdicon.woff
http://7xkkhh.com1.z0.glb.clouddn.com/2016/08/01/14700177870141.jpg?imageView2/1/w/600/h/302
# 需要在线访问的文件
NETWORK:
*
# 替代方案
FALLBACK:
#/ offline.html
EOF;
exit;
}
示例8: graphs
function graphs()
{
$t = $_GET["t"];
/*
if($t=='day'){$day='id=tab_current';$title=$t;$t="1$t";}
if($t=='week'){$week='id=tab_current';$t="2$t";}
if($t=='month'){$month='id=tab_current';$t="3$t";}
<div id=tablist>
<li><a href=\"javascript:LoadAjax2('graphs','$page?graph=yes&hostname={$_GET["hostname"]}&t=day');\">{day}</a></li>
<li><a href=\"javascript:LoadAjax2('graphs','$page?graph=yes&hostname={$_GET["hostname"]}&t=week');\">{week}</a></li>
<li><a href=\"javascript:LoadAjax2('graphs','$page?graph=yes&hostname={$_GET["hostname"]}&t=month');\">{month}</a></li>
</div>*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("content-type:text/html");
$md = md5(date('Ymdhis'));
$users = new usersMenus(nul, 0, $_GET["hostname"]);
$html = "\n<input type='hidden' id='t' value='{$t}'>\n<p class='caption'>{queue_flow_text}</p>\n<table style='width:600px' align=center>\n<tr>\n<td valign='top'>\n\t<center style='margin:4px'>\n\t\t<H5>{queue_flow_day}</H5>\n\t\t<img src='images.listener.php?uri=mailgraph/queuegraph_0.png&md={$md}'>\n\t</center>\n\t<center style='margin:4px'>\n\t\t<H5>{queue_flow_week}</H5>\n\t\t<img src='images.listener.php?uri=mailgraph/queuegraph_1.png&md={$md}'>\n\t</center>\n\t<center style='margin:4px'>\n\t\t<H5>{queue_flow_month}</H5>\n\t\t<img src='images.listener.php?uri=mailgraph/queuegraph_2.png&md={$md}'>\n\t</center>\n\t<center style='margin:4px'>\n\t\t<H5>{queue_flow_year}</H5>\n\t\t<img src='images.listener.php?uri=mailgraph/queuegraph_3.png&md={$md}'>\n\t</center>\t\t\t\t\t\t\n</td>\n</tr>\n</table>\t";
$tpl = new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例9: delete_multi
/**
* @author KhaVu
* @copyright 2015-04-21
* @param $param
* @return
*/
function delete_multi($id)
{
$now = gmdate("Y-m-d H:i:s", time() + 7 * 3600);
//$sql = "UPDATE `gds_stock_device` SET `del_if` = 1, `dateupdated` = '$now' WHERE `device_id` IN ($id) and `device_id` > 0";
//$this->model->query($sql)->execute();
$this->model->table('gds_stock_device')->where("device_id in({$id})")->update(array('del_if' => 1, 'dateupdated' => $now));
}
示例10: getCacheHeaders
public function getCacheHeaders(ConcretePage $c)
{
$lifetime = $c->getCollectionFullPageCachingLifetimeValue();
$expires = gmdate('D, d M Y H:i:s', time() + $lifetime) . ' GMT';
$headers = array('Pragma' => 'public', 'Cache-Control' => 'max-age=' . $lifetime . ',s-maxage=' . $lifetime, 'Expires' => $expires);
return $headers;
}
示例11: doGet
/**
* Do a GET request.
*
* @param resource $ch
* @param string $url
* @throws CurlException
* @return string
*/
private function doGet($ch, $url)
{
$now = time();
$resource = $this->getResourceName($url);
$date = $this->cache->getDate($resource);
$limit = $now - $this->ttl;
//Return content if ttl has not yet expired.
if ($date > 0 && $date > $limit) {
return $this->cache->getContent($resource);
}
//Add the If-Modified-Since header
if ($date > 0) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array(sprintf("If-Modified-Since: %s GMT", gmdate("D, d M Y H:i:s", $date))));
}
curl_setopt($ch, CURLOPT_FILETIME, true);
$data = $this->curlExec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$date = curl_getinfo($ch, CURLINFO_FILETIME);
curl_close($ch);
//Return content from cache.
if ($httpCode == 304) {
$this->cache->setDate($resource, $date);
return $this->cache->getContent($resource);
}
//Cache content
if ($httpCode == 200) {
$date = $date >= 0 ? $date : $now;
$this->cache->cache($resource, $date, $data);
return $data;
}
throw new CurlException(sprintf('Cannot fetch %s', $url), $httpCode);
}
示例12: setCacheHeader
/**
* @param $expires
*/
public function setCacheHeader($expires)
{
$this->setHeader('Last-Modified', gmdate('D, d M Y H:i:s T', time()));
$this->setHeader('Expires', gmdate('D, d M Y H:i:s T', time() + $expires));
$this->setHeader('Cache-Control', 'private, max-age=' . $expires);
$this->setHeader('Pragma', '');
}
示例13: retrieveFile
/**
* Retrieves data from cache, if it's there. If it is, but it's expired,
* it performs a conditional GET to see if the data is updated. If it
* isn't, it down updates the modification time of the cache file and
* returns the data. If the cache is not there, or the remote file has been
* modified, it is downloaded and cached.
*
* @param string URL of remote file to retrieve
* @param int Length of time to cache file locally before asking the server
* if it changed.
* @return string File contents
*/
function retrieveFile($url, $cacheLength, $cacheDir)
{
$cacheID = md5($url);
$cache = new Cache_Lite(array("cacheDir" => $cacheDir, "lifeTime" => $cacheLength));
if ($data = $cache->get($cacheID)) {
return $data;
} else {
// we need to perform a request, so include HTTP_Request
include_once 'HTTP/Request.php';
// HTTP_Request has moronic redirect "handling", turn that off (Alexey Borzov)
$req = new HTTP_Request($url, array('allowRedirects' => false));
// if $cache->get($cacheID) found the file, but it was expired,
// $cache->_file will exist
if (isset($cache->_file) && file_exists($cache->_file)) {
$req->addHeader('If-Modified-Since', gmdate("D, d M Y H:i:s", filemtime($cache->_file)) . " GMT");
}
$req->sendRequest();
if (!($req->getResponseCode() == 304)) {
// data is changed, so save it to cache
$data = $req->getResponseBody();
$cache->save($data, $cacheID);
return $data;
} else {
// retrieve the data, since the first time we did this failed
if ($data = $cache->get($cacheID, 'default', true)) {
return $data;
}
}
}
Services_ExchangeRates::raiseError("Unable to retrieve file {$url} (unknown reason)", SERVICES_EXCHANGERATES_ERROR_RETRIEVAL_FAILED);
return false;
}
示例14: getOrderBy
/**
* checks the request for the order by and if that is not set then it checks the session for it
*
* @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field
*/
function getOrderBy($orderBy = '', $direction = '')
{
if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) {
if (!empty($_REQUEST[$this->var_order_by])) {
$direction = 'ASC';
$orderBy = $_REQUEST[$this->var_order_by];
if (!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0)) {
$direction = $_REQUEST['lvso'];
$trackerManager = TrackerManager::getInstance();
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('module_name', $GLOBALS['module']);
$monitor->setValue('item_summary', "lvso=" . $direction . "&" . $this->var_order_by . "=" . $_REQUEST[$this->var_order_by]);
$monitor->setValue('action', 'listview');
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('date_modified', gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$monitor->save();
}
}
}
$_SESSION[$this->var_order_by] = array('orderBy' => $orderBy, 'direction' => $direction);
$_SESSION['lvd']['last_ob'] = $orderBy;
} else {
if (!empty($_SESSION[$this->var_order_by])) {
$orderBy = $_SESSION[$this->var_order_by]['orderBy'];
$direction = $_SESSION[$this->var_order_by]['direction'];
}
}
return array('orderBy' => $orderBy, 'sortOrder' => $direction);
}
示例15: timestampToRFC2616
/**
* Convert an epoch timestamp into an RFC2616 (HTTP) compatible date.
* @param type $timestamp Optionally, an epoch timestamp. Defaults to the current time.
*/
public static function timestampToRFC2616($timestamp = false)
{
if ($timestamp === false) {
$timestamp = time();
}
return gmdate('D, d M Y H:i:s T', (int) $timestamp);
}