Home > Backend Development > PHP Tutorial > 关于Smarty模板的缓存有关问题

关于Smarty模板的缓存有关问题

WBOY
Release: 2016-06-13 13:12:13
Original
894 people have browsed it

关于Smarty模板的缓存问题。
我开启了缓存
require dirname(__FILE__).'/run.inc.php';
global $_tpl;
if(!$_tpl->is_cached('member.tpl',$_SERVER['REQUEST_URI'])){
$_member=new MemberAction();
$_member->action();
}
$_tpl->display('member.tpl',$_SERVER['REQUEST_URI']);
$_tpl是smarty模板,MemberAction()是控制器。简单来说是在member.php?action=showupdate里修改了文件数据,这样就跳到member.php?action=show中,但是因为缓存的关系,它直接就加载了member.php?action=show的缓存文件,在member.php?action=show中看不到数据的变化,但数据库数据时修改了的。我想知道如何及时更新数据,修改的部分不缓存。

------解决方案--------------------
smarty有个标记是不缓存的{insert}

另一种办法就是member.php?action=showupdate执行完,调用smarty的方法更新member.php?action=show的缓存

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template