PHP菜鸟关于smarty第30讲中的缓存问题?

我看不懂下面代码?那位大虾能helpme......index.php<?phpinclude("smarty_inc.php");include("mysql_inc.... 我看不懂下面代码?那位大虾能help me......

index.php
<?php
include("smarty_inc.php");
include("mysql_inc.php");

if ($GET[id]){
$sql="Select * from 'php100' where id=".$GET[id];
$query=$db->query($sql);
$row=$db->fetch_row($query);
$db->query('update php100 set hit=hit+1 where id='._GET[id]);
}
$smarty->assign('row',$row);
$smarty->display('index.htm');

//如果缓存开了,怎样不使用缓存呢?使用如下insert方式
function insert_hit(){
global $row;
return $row[2];
}
>

index.htm:
标题:{$row[1]}<br>
点击:{insert name="hit"}<br>
展开
 我来答
yorcin
2012-09-15 · 超过13用户采纳过TA的回答
知道答主
回答量:71
采纳率:0%
帮助的人:35.3万
展开全部
index.php
<?php
include("smarty_inc.php"); // 导入smarty配置文件
include("mysql_inc.php"); // 导入数据库配置文件

if ($GET[id]){ // 获取通过get方式传过来的 id 值

$sql="Select * from 'php100' where id=".$GET[id]; // 执行数据库操作搜索语句,执行条件 从‘php100’ 这张表查找id是否有与获取的id值相同的

$query=$db->query($sql); // 开始执行
$row=$db->fetch_row($query); // 获取结果集
$db->query('update php100 set hit=hit+1 where id='._GET[id]); // 更新操作 使查到的结果中的hit 加 1
}
$smarty->assign('row',$row); // 获取结果集 并存到变量 row 里面
$smarty->display('index.htm'); //显示
china_youse
2012-09-21 · TA获得超过264个赞
知道答主
回答量:74
采纳率:0%
帮助的人:132万
展开全部
其实就是一个php运用smarty,在缓存页面中的动态显示问题。你可以看看你的缓存开了没有,可以比较一下开缓存与没有开缓存之间的区别!!!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
ddvsrain
2012-09-21
知道答主
回答量:3
采纳率:0%
帮助的人:4779
展开全部
你确定你缓存开了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式