admin 发表于 2020-11-25 14:04

smarty的缓存是页面缓存

缓存:页面缓存、空间缓存、数据缓存。smarty中的缓存就是页面缓存smarty的缓存是页面缓存。开启缓存$smarty->caching=true|1;                //开启缓存1.10.2缓存的更新方法一:删除缓存,系统会重新生成新的缓存文件方法二:更新了模板文件,配置文件,缓存自动更新方法三:过了缓存的生命周期,默认是3600秒方法四:强制更新PHP代码<?php
require './Smarty/smarty.class.php';
$smarty=new Smarty();
$smarty->caching=true;                //开启缓存
if(date('H')>=9)
      $smarty->force_cache=true;      //强制更新缓存
$smarty->display('6-demo.html');缓存的生命周期$smarty->cache_lifetime=-1 | 0 | N
-1:永远不过期
0:立即过期
N:有效期是N秒,默认是3600秒PHP代码
$smarty->cache_lifetime=3;        //缓存的生命周期

页: [1]
查看完整版本: smarty的缓存是页面缓存