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


PHP httpCache::checkMTime方法代码示例

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


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

示例1: minify

 public function minify($cacheFile = null, $dir = null)
 {
     if ($dir === null) {
         $dir = dirname($_SERVER['SCRIPT_FILENAME']);
     }
     // MODIFICATION TIME FILES
     $mtFiles = array(__FILE__, $_SERVER['SCRIPT_FILENAME'], "conf/config.php");
     // GET SOURCE CODE FILES
     $files = dir::content($dir, array('types' => "file", 'pattern' => '/^.*\\.' . $this->type . '$/'));
     // GET NEWEST MODIFICATION TIME
     $mtime = 0;
     foreach (array_merge($mtFiles, $files) as $file) {
         $fmtime = filemtime($file);
         if ($fmtime > $mtime) {
             $mtime = $fmtime;
         }
     }
     $header = "Content-Type: {$this->mime[$this->type]}";
     // GET SOURCE CODE FROM CLIENT HTTP CACHE IF EXISTS
     httpCache::checkMTime($mtime, $header);
     // OUTPUT SOURCE CODE
     header($header);
     // GET SOURCE CODE FROM SERVER-SIDE CACHE
     if ($cacheFile !== null && file_exists($cacheFile) && (filemtime($cacheFile) >= $mtime || !is_writable($cacheFile))) {
         // with its distribution content
         readfile($cacheFile);
         die;
     }
     // MINIFY AND JOIN SOURCE CODE
     $source = "";
     foreach ($files as $file) {
         if (strlen($this->minCmd) && substr($file, 4, 1) != "_") {
             $cmd = str_replace("{file}", $file, $this->minCmd);
             $source .= `{$cmd}`;
         } else {
             $source .= file_get_contents($file);
         }
     }
     // UPDATE SERVER-SIDE CACHE
     if ($cacheFile !== null && (is_writable($cacheFile) || !file_exists($cacheFile) && dir::isWritable(dirname($cacheFile)))) {
         file_put_contents($cacheFile, $source);
         touch($cacheFile, $mtime);
     }
     // OUTPUT SOURCE CODE
     echo $source;
 }
开发者ID:brandon-bailey,项目名称:osdms,代码行数:46,代码来源:minifier.php

示例2: header

 *    @author Pavel Tzonkov <sunhater@sunhater.com>
 * @copyright 2010-2014 KCFinder Project
 *   @license http://opensource.org/licenses/GPL-3.0 GPLv3
 *   @license http://opensource.org/licenses/LGPL-3.0 LGPLv3
 *      @link http://kcfinder.sunhater.com
 */
namespace kcfinder;

require "core/autoload.php";
if (!isset($_GET['lng']) || $_GET['lng'] == 'en' || $_GET['lng'] != basename($_GET['lng']) || !is_file("lang/" . $_GET['lng'] . ".php")) {
    header("Content-Type: text/javascript");
    die;
}
$file = "lang/" . $_GET['lng'] . ".php";
$mtime = @filemtime($file);
if ($mtime) {
    httpCache::checkMTime($mtime, "Content-Type: text/javascript");
}
require $file;
header("Content-Type: text/javascript");
echo "_.labels={";
$i = 0;
foreach ($lang as $english => $native) {
    if (substr($english, 0, 1) != "_") {
        echo "'" . text::jsValue($english) . "':\"" . text::jsValue($native) . "\"";
        if (++$i < count($lang)) {
            echo ",";
        }
    }
}
echo "}";
开发者ID:christianallred,项目名称:fluent_univ,代码行数:31,代码来源:js_localize.php

示例3: browser

/** This file is part of KCFinder project
 *
 *      @desc Base CSS definitions
 *   @package KCFinder
 *   @version 2.21
 *    @author Pavel Tzonkov <pavelc@users.sourceforge.net>
 * @copyright 2010 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
require "core/autoload.php";
$mtime = @filemtime(__FILE__);
if ($mtime) {
    httpCache::checkMTime($mtime);
}
$browser = new browser();
$config = $browser->config;
ob_start();
?>
html, body {
overflow: hidden;
}

body, form, th, td {
margin: 0;
padding: 0;
}

a {
开发者ID:alejandrozepeda,项目名称:gvm,代码行数:30,代码来源:css.php


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