如何清除Smarty的缓存

6 php caching smarty

我们公司的原始所有者使用Smartys设计了网站.我已经更新了产品页面,但即使从"templates_c"中删除临时文件(我认为是缓存文件),更新的产品页面也根本不会显示,所有内容仍然看起来与之前完全一样.

如何清除Smartys上的缓存,以便我的修改后的页面可以查看?

Mic*_*ski 13

Smarty使用编译目录和单独的缓存目录.templates_c可能是编译目录.缓存在中指定$smarty->cache_dir.那是你需要清空的那个.

在PHP中使用Smarty版本2,您可以执行该功能 clear_all_cache()

$smarty->clear_all_cache();
Run Code Online (Sandbox Code Playgroud)

如果您使用的是Smarty版本3,则命令为 clearAllCache()

$smarty->clearAllCache();
Run Code Online (Sandbox Code Playgroud)

要找出缓存目录:

echo $smarty->cache_dir;
Run Code Online (Sandbox Code Playgroud)