include_once("smarty/libs/Smarty.class.php");
$smarty = new Smarty;
$smarty->template_dir = "templates/";
$smarty->compile_dir = "templates_c/";
$smarty->config_dir = "configs/";
$smarty->cache_dir = "cache/";
$smarty->assign("name","****".time());  /*这里有个时间函数*/
$smarty->display("index.tpl");
这样做达到缓存的效果了吗?

解决方案 »

  1.   

    smarty是对模板缓存默认状态下是有缓存的。
    至于你的程序内容是否缓存,那只能问你自己了。
      

  2.   

    $smarty->caching=1 或者 2 ...
      

  3.   

    $smarty->caching=1 或者 2 ...这么缓存和直接生成静态页 又没什么区别了。
      

  4.   

    $smarty->'caching' = true;
    这样才是打开缓存.默认是只编译tpl模板到php.这样就不用每次都编译模板了.节省了编译的过程.
    数据缓存就需要打开上面的开关.
      

  5.   

    1.php 产生的缓存页 和1.php?kk=12 产生的缓存页是一样的吗?我自己测试是 同一个缓存文件。
      

  6.   


    你一定没有好好看smarty手册。在$smarty->display的时候,还有几个参数你没用到。
      

  7.   

    咋这么多人喜欢用Smarty这些东西?
      

  8.   

    可是说是打开了smarty的缓存了,我是不喜欢使用smarty的缓存的,我以前用经常出现这种情况,就是不管我怎么修改代码,前台页面都没有变化,我要把缓存清一下才可以看到变化的.
      

  9.   


    正因如此,用了smarty的网站才会快。