急求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 建站系统 木子建站V1.4版本 开源资源 PHP如何解析这种格式的文件 SuperSite7.0的一个问题,望高手帮帮忙。。。 跨域问题 wamp配置两个虚拟主机后,访问不正常 php连接数据库问题 web开发学什么好?哪个比较容易入门?前途好?工作机会多? 问一个discuz的问题 求助网站对浏览器支持不好,首页大图显示空白,只有360浏览器经常出现 php-wget的问题,好像不执行 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就行了。