我在我的 smarty 中启用了缓存,并分配了如下日期和时间,如果页面未缓存,则仅从数据库中获取该日期和时间:
$smarty->assign('added_timestamp', $added_timestamp);
我有一个自定义的 smarty 修饰符,它生成一个相对时间段,如(20 分钟 5 秒前)
{$added_timestamp|relative_time}
现在我需要的是,'$ added_timestamp' 的值必须被缓存但是{$added_timestamp|relative_time}
不应该缓存来自的输出。
我试过了,{nocache}{$added_timestamp|relative_time}{/nocache}
但它不起作用。
有什么建议么?