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


PHP Q_Request::cacheTimestamp方法代码示例

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


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

示例1: cachedUrl

 /**
  * This function is very useful to use with clients like PhoneGap which can
  * intercept URLs and load whatever locally cached files are stored in their bundle.
  * The urls for these files will be relative to the cache base url.
  * (See Q_Uri::cacheBaseUrl function).
  * In this case, the client is supposed to send the timestamp of when the
  * cache it is using was generated.
  * This function checks the current contents of the Q/config/Q/urls.php file,
  * generated by scripts/Q/urls.php script.
  * If the url's timestamp there is newer than the Q_Request::cacheTimestamp()
  * (which the client can set by setting the 'Q_ct' field in the querystring)
  * then that means the server has a newer version of the file, so the passed
  * $url is used instead.
  * Otherwise, the url relative to cacheBaseUrl is used, making the client
  * load the locally cached version.
  */
 static function cachedUrl($url)
 {
     $timestamp = Q_Request::cacheTimestamp();
     if (empty($timestamp)) {
         return $url;
     }
     $urlRelativeToBase = substr($url, strlen(Q_Request::baseUrl()));
     $fileTimestamp = isset(Q_Uri::$urls[$urlRelativeToBase]) ? Q_Uri::$urls[$urlRelativeToBase] : null;
     if (isset($fileTimestamp) and $fileTimestamp <= $timestamp and self::$cacheBaseUrl) {
         return self::$cacheBaseUrl . $urlRelativeToBase;
     }
     return $url;
 }
开发者ID:atirjavid,项目名称:Platform,代码行数:29,代码来源:Uri.php

示例2: cachedUrl

 /**
  * This function is very useful to use with clients like PhoneGap which can
  * intercept URLs and load whatever locally cached files are stored in their bundle.
  * The urls for these files will be relative to the cache base url.
  * (See Q_Uri::cacheBaseUrl function).
  * In this case, the client is supposed to send the timestamp of when the
  * cache it is using was generated.
  * This function checks the current contents of the Q/config/Q/urls.php file,
  * generated by scripts/Q/urls.php script.
  * If the url's timestamp there is newer than the Q_Request::cacheTimestamp()
  * (which the client can set by setting the 'Q_ct' field in the querystring)
  * then that means the server has a newer version of the file, so the passed
  * $url is used instead.
  * Otherwise, the url relative to cacheBaseUrl is used, making the client
  * load the locally cached version.
  */
 static function cachedUrl($url)
 {
     $timestamp = Q_Request::cacheTimestamp();
     if (empty($timestamp)) {
         return $url;
     }
     $urlRelativeToBase = substr($url, strlen(Q_Request::baseUrl(false, true)));
     $parts = explode('/', $urlRelativeToBase);
     $parts[] = null;
     $tree = new Q_Tree(Q_Uri::$urls);
     $fileTimestamp = call_user_func_array(array($tree, 'get'), $parts);
     if (isset($fileTimestamp) and $fileTimestamp <= $timestamp and self::$cacheBaseUrl) {
         return self::$cacheBaseUrl . $urlRelativeToBase;
     }
     return $url;
 }
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:32,代码来源:Uri.php


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