麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
smarty模板设了缓存还会读数据库吗?
悬赏分:20 - 2007年08月22日

我的网页是这样设计的:
从MYSQL数据库读出数据,用SMARTY模板调出网页,缓存时间设3600秒.
在缓存的这段时间,网页是不会显示新的数据了,但是不知道还会调数据库吗?占用数据库资源吗?
因为程序是先读MYSQL,再读入SMARTYR的.
比如这样:
<?
include "config.php";
$text="";
$str="select name from tabal";
$res=mysql_db_query($data,$str);
for($i=0;$i<6;$i++)
{
$row=mysql_fetch_row($res);
$text[$i]=$row[name];
}
$inew="6";

//引用类文件
require 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;

$smarty->template_dir = "smarty/templet";
$smarty->compile_dir = "smarty/templates/templates_c";
$smarty->config_dir = "smarty/templates/config";
$smarty->cache_dir = "smarty/templates/cache";

$smarty->caching=true;
$smarty->cache_lifetime =3600;

$smarty->assign('count', $inew);
$smarty->assign("LEINAME",$text);

$fileurl="index.html";
$smtpl="01";
$smarty->display($fileurl,$smtpl);
?>

[ 本帖最后由 网逍遥 于 2007-4-17 01:53 PM 编辑 ]

提问者:网逍遥   08-22 15:03
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
49 + 37 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM