$smarty->display('index.tpl',$my_cache_id);
clear_all_cache();//清除所有缓存
clear_cache('index.tpl');//清除index.tpl的缓存
clear_cache('index.tpl',cache_id);//清除指定id的缓存
$smarty->cache_handler_func = "myCache";
function myCache($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null){
}
switch($action){
case "read"://读取缓存内容
case "write"://写入缓存
case "clear"://清空
}
smarty_block_name($params,$content, &$smarty){return $content;}
//name表示区域名
$smarty->register_block('name', 'smarty_block_name', false);
//第三参数false表示该区域不被缓存
{name}内容{/name}
<?php
function smarty_block_cacheless($param, $content, &$smarty) {
return $content;
}
?>
<?php
include('Smarty.class.php');
$smarty = new Smarty;
$smarty->caching=true;
$smarty->cache_lifetime = 6;
$smarty->display('cache.tpl');
?>
已经缓存的:
{$smarty.now}<br>
{cacheless}
没有缓存的:
{$smarty.now}
{/cacheless}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有