phpwind二次开发之简单phpwind更改帖子浏览率

有人问道这个问题,其实,phpwind更改帖子浏览率非常简单的

代码在read.php里面约368行:

//更新帖子点击
if (!$db_hithour) {
//$db->update(‘UPDATE pw_threads SET hits=hits+1 WHERE tid=’.S::sqlEscape($tid));
pwQuery::update(‘pw_threads’, ‘tid=:tid’, array($tid), null, array(PW_EXPR=>array(‘hits=hits+1′)));
} else {
pwCache::setData(D_P.’data/bbscache/hits.txt’,$tid.”\t”, false, ‘ab’);
}

改为:

//更新帖子点击
if (!$db_hithour) {
//$db->update(‘UPDATE pw_threads SET hits=hits+1 WHERE tid=’.S::sqlEscape($tid));
//pwQuery::update(‘pw_threads’, ‘tid=:tid’, array($tid), null, array(PW_EXPR=>array(‘hits=hits+1′)));

//start 

 

$hittmp = rand(2,10);
pwQuery::update(‘pw_threads’, ‘tid=:tid’, array($tid), null, array(PW_EXPR=>array(“hits=hits+$hittmp”)));
unset($hittmp);  // 消除变量。

 

//end
} else {
pwCache::setData(D_P.’data/bbscache/hits.txt’,$tid.”\t”, false, ‘ab’);
}


来源:合肥网产品中心    http://lab.wehefei.com


 

 

 

posted @ 2011-03-21 23:08  小寒子  阅读(317)  评论(0编辑  收藏  举报