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");
这样做达到缓存的效果了吗?
$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");
这样做达到缓存的效果了吗?
至于你的程序内容是否缓存,那只能问你自己了。
这样才是打开缓存.默认是只编译tpl模板到php.这样就不用每次都编译模板了.节省了编译的过程.
数据缓存就需要打开上面的开关.
你一定没有好好看smarty手册。在$smarty->display的时候,还有几个参数你没用到。
正因如此,用了smarty的网站才会快。