本文整理汇总了PHP中OC_Response::setLastModifiedHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Response::setLastModifiedHeader方法的具体用法?PHP OC_Response::setLastModifiedHeader怎么用?PHP OC_Response::setLastModifiedHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Response
的用法示例。
在下文中一共展示了OC_Response::setLastModifiedHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setLastModifiedHeader
/**
* Checks and set Last-Modified header, when the request matches sends a
* 'not modified' response
* @param string $lastModified time when the reponse was last modified
*/
public static function setLastModifiedHeader($lastModified)
{
\OC_Response::setLastModifiedHeader($lastModified);
}
示例2: getTmpAvatar
public static function getTmpAvatar($args)
{
\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
$tmpavatar = \OC_Cache::get('tmpavatar');
if (is_null($tmpavatar)) {
$l = new \OC_L10n('core');
\OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again"))));
return;
}
$image = new \OC_Image($tmpavatar);
\OC_Response::disableCaching();
\OC_Response::setLastModifiedHeader(time());
\OC_Response::setETagHeader(crc32($image->data()));
$image->show();
}
示例3: show
public function show()
{
if ($this->useOriginal) {
$fp = @$this->view->fopen($this->path, 'rb');
$mtime = $this->view->filemtime($this->path);
$size = $this->view->filesize($this->path);
$mime = $this->view->getMimetype($this->path);
} else {
$fp = @fopen($this->path, 'rb');
$mtime = filemtime($this->path);
$size = filesize($this->path);
$mime = \OC_Helper::getMimetype($this->path);
}
if ($fp) {
\OC_Response::enableCaching();
\OC_Response::setLastModifiedHeader($mtime);
header('Content-Length: ' . $size);
header('Content-Type: ' . $mime);
fpassthru($fp);
} else {
\OC_Response::setStatus(\OC_Response::STATUS_NOT_FOUND);
}
}
示例4: loadfile
public static function loadfile()
{
if (file_exists(OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE)) {
if (substr(OC::$REQUESTEDFILE, -3) == 'css') {
$appswebroot = (string) OC::$APPSWEBROOT;
$webroot = (string) OC::$WEBROOT;
$filepath = OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
header('Content-Type: text/css');
OC_Response::enableCaching();
OC_Response::setLastModifiedHeader(filemtime($filepath));
$cssfile = file_get_contents($filepath);
$cssfile = str_replace('%appswebroot%', $appswebroot, $cssfile);
$cssfile = str_replace('%webroot%', $webroot, $cssfile);
OC_Response::setETagHeader(md5($cssfile));
header('Content-Length: ' . strlen($cssfile));
echo $cssfile;
exit;
} elseif (substr(OC::$REQUESTEDFILE, -3) == 'php') {
require_once OC::$APPSROOT . '/apps/' . OC::$REQUESTEDAPP . '/' . OC::$REQUESTEDFILE;
}
} else {
header('HTTP/1.0 404 Not Found');
exit;
}
}