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


原文地址:https://www.cnblogs.com/jincon/p/1990842.html