急求smarty缓存问题解决方案 我在smarty模板里引入了其他的模板,比方说引入了a.html文件,结果smarty缓存不起作用了,每次访问都刷新,如果我不引入a.html文件就没什么问题,谁能知道这是怎么回事?该怎么解决啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这里牵扯到smarty的运行机制,我就不多解释了。在引用这个界面的时候不要 使用include要使用insert比如<!--{insert name="getBanner" file="a.html"}-->这样就可以解决缓存的问题了。 include_once("smartylib/Smarty.class.php"); //包含smarty类文件$smarty = new Smarty(); //建立smarty实例对象$smarty$smarty->config_dir="smartylib/Config_File.class.php"; // 目录变量$smarty->caching=false; //是否使用缓存,项目在调试期间,不建议启用缓存$smarty->template_dir = "./templates"; //设置模板目录-->>当前目录$smarty->template_dir = "../templates"; //设置模板目录-->>上级目录$smarty->compile_dir = "./templates_c"; //设置编译目录$smarty->cache_dir = "./smarty_cache"; //缓存文件夹//$smarty->caching = true; //开启缓存,为flase的时侯缓存无效$smarty->cache_lifetime = 30; //缓存时间(秒)//模板引用smarty开始结束符号$smarty->left_delimiter = "{";$smarty->right_delimiter = "}";第4行,要开启缓存,改为TRUE就行了。 用smarty开启缓存我还能不知道啊,哎,得了,不整这个了 招聘:PHP高级软件工程师【急】--成都 如何用$snoopy获取这个WMA地址 是关于ECshop的问题,请高手帮我分析分析 php集成环境安装好了,但运行不起来,请高手帮忙,急急.... 亲们,谁有很快入手的discuz的资料啊, fckeditor显示内容问题: PHP关于附件上传解压缩的问题 用wordpress做一个企业站,遇到一个调用问题。 微信扫码支付的问题 MAC系统php -v和phpinfo显示的版本不一致 php 有没有发展前途 急求smarty缓存问题解决方案
要使用insert比如<!--{insert name="getBanner" file="a.html"}-->这样就可以解决缓存的问题了。
include_once("smartylib/Smarty.class.php"); //包含smarty类文件$smarty = new Smarty(); //建立smarty实例对象$smarty$smarty->config_dir="smartylib/Config_File.class.php"; // 目录变量$smarty->caching=false; //是否使用缓存,项目在调试期间,不建议启用缓存$smarty->template_dir = "./templates"; //设置模板目录-->>当前目录$smarty->template_dir = "../templates"; //设置模板目录-->>上级目录$smarty->compile_dir = "./templates_c"; //设置编译目录$smarty->cache_dir = "./smarty_cache"; //缓存文件夹//$smarty->caching = true; //开启缓存,为flase的时侯缓存无效$smarty->cache_lifetime = 30; //缓存时间(秒)//模板引用smarty开始结束符号
$smarty->left_delimiter = "{";$smarty->right_delimiter = "}";第4行,要开启缓存,改为TRUE就行了。