最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php 緩存函數(shù)代碼

 更新時(shí)間:2008年08月27日 12:55:37   作者:  
簡(jiǎn)單實(shí)用的緩存函數(shù)

復(fù)制代碼 代碼如下:

**
* @說(shuō)明: 文件緩存輸出
* @參數(shù): $cachefile => cache文件(絕對(duì)路徑)
* @參數(shù): $pertime => 緩存輸出的間隔時(shí)間
* @參數(shù): $sql => sql語(yǔ)句
* @參數(shù): $templatefile => 模板文件名稱(絕對(duì)路徑)
* www.php100.com 來(lái)自
**/
function __cache($cachefile,$pertime,$sql,$templatefile) {
global $db;
if(time() - @filemtime($cachefile) >= $pertime) {
$query = $db->query($sql);
while($r=$db->fetch($query)) {
$cachelist[] = $r;
}
include $templatefile.'.php';
$cacheserialize = serialize($cachelist);
file_put_contents($cachefile,$cacheserialize);
}else{
$cachelist = unserialize(file_get_contents($cachefile));
include $templatefile.'.php';
}
}

相關(guān)文章

最新評(píng)論

定安县| 高淳县| 江达县| 沭阳县| 咸丰县| 彭泽县| 台江县| 菏泽市| 游戏| 麻江县| 定西市| 枞阳县| 平昌县| 曲周县| 浮梁县| 榆林市| 兴隆县| 大安市| 湖口县| 怀来县| 靖宇县| 萝北县| 怀宁县| 延边| 沧州市| 云安县| 广河县| 邓州市| 吕梁市| 微博| 海淀区| 南城县| 牡丹江市| 阿坝| 永登县| 武隆县| 云和县| 陵水| 江口县| 安阳市| 平定县|