您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

smarty模板局部缓存实例教程

2024/6/20 12:22:48发布29次查看
require('smarty.class.php'); $smarty = new smarty; $smarty->caching = true;function smarty_block_dynamic($param, $content, &$smarty) { return $content; } $smarty->register_block('dynamic', 'smarty_block_dynamic', false);$smarty->display('index.tpl');
复制代码
index.tpl模板文件:
page created: {0|date_format:%d %h:%m:%s}
{dynamic}now is: {0|date_format:%d %h:%m:%s}... do other stuff ...{/dynamic}
复制代码
当重新加载此页面时,会注意到这两个日期不同。一个是“动态“,一个是“静态”。你能够在{dynamic}...{/dynamic}之间作任何事情,并且保证它将不会像剩下的页面一样被缓存。
以上就是smarty模板局部缓存的例子,希望对大家有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product