smarty 缓存
来源:互联网 发布:python界面开发 编辑:程序博客网 时间:2024/05/17 22:35
缓存这个是smarty中比较重要的一部分了,因为有了一个定义好的缓存能为用户节省不少的时间,缓存的工作原理就是把缓存这个页面存入一个新的文件夹等第二次用的时候就不用重新加载分析了,直接输出这个页面就ok了,还有一个特例就是单页面多缓存这样的话就要在·dispaly的后面多家一个可以根据页面变化传递的值,比如id之类的就可以创建多个缓存了,
<?phpmysql_connect('localhost','root','123');
mysql_select_db('xsxx');
mysql_query("set names utf8");
include("../libs/Smarty.class.php");
$smarty = new Smarty();
$smarty->caching=1;
$smarty->reInitSmarty("../demo/templates","../demo/templates_c","../demo/configs","../demo/cache");
if(!$smarty->is_cached("stu_details.tpl",$_GET["id"])){
$q = "select * from stu where id = ".$_GET["id"];
$result = mysql_query($q);
$array = array();
$i=0;
while($row = mysql_fetch_assoc($result)){
$array[$i]=$row;
$i++;
}
$smarty->assign("stu_details",$array);
echo "缓存没有被设置。。";
}
$smarty->display("stu_details.tpl",$_GET["id"]);
?>
用get传递的id可以让缓存变得一个单页面多缓存这样是很方便的
- php+smarty ,smarty 缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- Smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty 缓存
- smarty缓存
- smarty 缓存
- smarty缓存,
- smarty缓存
- Smarty缓存
- Smarty缓存
- android布局
- Hsqldb usage
- unicast、broadcast、multicast的区别
- MBCS下日志打印(1)
- android中布局背景 圆角 的实现
- smarty 缓存
- STM32F103C8T6 Standby低功耗模式
- TagSupport类的生命周期
- 自定义标签JspFragment类
- linux下查看串口信息
- 周总结
- CString的构造函数
- Eclipse中将Java Project转换为Dynamic Web Project
- java画板小demo