smarty缓存复习代码
来源:互联网 发布:tcp协议栈源码 编辑:程序博客网 时间:2024/06/04 18:48
<?php
include ("libs/Smarty.class.php");
$smarty=new Smarty();
$smarty->InitSmarty("demo/templates","demo/templates_c","demo/config");
$smarty->caching=1;
$smarty->cache_dir='demo/cache';
//判断是否已经存在缓存
if(!$smarty->is_cached("brand_info.tpl")){
mysql_connect("localhost","root","123") or die("数据库连接错误");
mysql_select_db("ec_shop");
mysql_query("set names utf8");
$result=mysql_query("select * from brand");
$return=array();
while($row=mysql_fetch_assoc($result))
{
$return[]=$row;
}
//var_dump($return);
$smarty->assign("array",$return);
echo "模板没有被缓存";
}
/*
$i=0;
while($row=mysql_fetch_assoc($result))
{
$array[$i]=$row;$i++;
}
*/
//$smarty->cache_lifetime=10;
$smarty->display("brand_info.tpl");//相当于加载进来的路径用的是php文件的
include ("libs/Smarty.class.php");
$smarty=new Smarty();
$smarty->InitSmarty("demo/templates","demo/templates_c","demo/config");
$smarty->caching=1;
$smarty->cache_dir='demo/cache';
//判断是否已经存在缓存
if(!$smarty->is_cached("brand_info.tpl")){
mysql_connect("localhost","root","123") or die("数据库连接错误");
mysql_select_db("ec_shop");
mysql_query("set names utf8");
$result=mysql_query("select * from brand");
$return=array();
while($row=mysql_fetch_assoc($result))
{
$return[]=$row;
}
//var_dump($return);
$smarty->assign("array",$return);
echo "模板没有被缓存";
}
/*
$i=0;
while($row=mysql_fetch_assoc($result))
{
$array[$i]=$row;$i++;
}
*/
//$smarty->cache_lifetime=10;
$smarty->display("brand_info.tpl");//相当于加载进来的路径用的是php文件的
- smarty缓存复习代码
- smarty复习
- smarty复习
- Smarty 复习
- php+smarty ,smarty 缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- Smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty缓存
- smarty 缓存
- smarty缓存
- smarty 缓存
- 一个关于析构的容易犯错的作用域的程序
- 黑马程序员--详解结构和类的异同
- iOS 开发:真机测试
- 黑马程序员之SQL学习笔记:数据库基础知识点学习总结
- 优秀的NAS不光只有群晖,看看威联通在安全性上如何K掉群晖
- smarty缓存复习代码
- 王远轩:北美求职记
- smarty设置参数
- stem算法
- IE10 平台预览版和 CSS 自适应布局功能
- git 常用命令
- 记我的第一次视频面试
- Use SWT to create browser application
- smarty中变量调节器