大家会问什么是
SMARTY缓存Cache:
<
?php
require('./smarty/Smarty.
![](/icons/95703class.gif)
.php');
$smarty =
![](/icons/95703new.gif)
Smarty; Z)
$smarty->caching = true;
![](/icons/95703if.gif)
(!$smarty->is_cached('index.tpl'))
// No cache available, do variable assignments here. )
$contents = get_database_contents
![](/icons/95703kh.gif)
;
$smarty->assign($contents);
}
$smarty->display('index.tpl'); )
?>
这个首先判断是否有这个缓存Cache文件!没有直接链接数据库!有
![](/icons/95703de.gif)
话!执行DISPLAY
![](/icons/95703dou2.gif)
就是读取缓存Cache
![](/icons/95703dou2.gif)
大家看到上面
![](/icons/95703de.gif)
2个例子!对缓存Cache有很大
![](/icons/95703de.gif)
理解了吧!
TAG:
PHP
缓存Cache
延伸阅读
最新评论