smarty3.0以上版本清除缓存与之前的区别

今天看一个smarty的教材,讲smarty的清除缓存的方法。
smarty3.0一下的版本的清除函数如下:
clear_all_cache()
clear_cache()
clear_assgin()
clear_compiled_tpl()
我就一一试用。结果发现出错如下:
Notice: function call 'clear_all_cache' is unknown or deprecated. in D:\wamp\www\php100-smarty-test\smarty\sysplugins\smarty_internal_wrapper.php on line 57
Notice: function call 'clear_assign' is unknown or deprecated. in D:\wamp\www\php100-smarty-test\smarty\sysplugins\smarty_internal_wrapper.php on line 57
Notice: function call 'clear_cache' is unknown or deprecated. in D:\wamp\www\php100-smarty-test\smarty\sysplugins\smarty_internal_wrapper.php on line 57
Notice: function call 'clear_compiled_tpl' is unknown or deprecated. in D:\wamp\www\php100-smarty-test\smarty\sysplugins\smarty_internal_wrapper.php on line 57
//提示这些函数名不存在或者已经被弃用。

在网上百度,发现有类似问题出现,是smarty的版本问题。但是网上没有提出解决办法。

经过查看libs\sysplugins\smarty_internal_cacheresource_file.php这个文件。
发现里面的函数基本上都类似这样是这样:
public function clearAll($exp_time = null)
    {
        return $this->clear(null, null, null, $exp_time);
    }

于是乎我猜想是:clearAll(); 结果还是错了;
我又想clearAll_cache(); 结果正确了 ;
于是有了下面:
//清除缓存文件
// clear only cache for index.tpl
$smarty->clearCache('index.html');
// clear out all cache files
$smarty->clearAllCache();

//清除编译模板
// clear a specific template resource
$smarty->clearCompiledTemplate('index.html');
// clear entire compile directory
$smarty->clearCompiledTemplate();
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值