Smarty模板未加载更新的php值,继续加载缓存模板

时间:2017-03-21 22:34:51

标签: php templates smarty

我使用的是smarty 3.x我有以下模板:

在index.tpl

<html>
<body>Time: {$time}
</body>
</html>

和文件index.php

<?php

require 'Smarty.class.php';

$smarty = new Smarty();
$smarty->debugging = true;
$smarty->caching = true;
$smarty->setTemplateDir('/www/');
$smarty->setCompileDir('/compiled/');
$smarty->setCacheDir('/cache/');

$time= date("H:i:s");
$smarty->assign("time", $time);
$smarty->display("index.tpl");
?>

当我加载页面时,加载模板显示时间,刷新页面时不更新时间(如果我在smarty中启用调试,则更新var $ time)。基本上页面是从缓存加载而不是更新时间变量。我查看了文档,但不清楚我应该使用什么配置来确保更新这些值并且模板是最佳加载的(即性能)。

0 个答案:

没有答案