比思論壇

標題: 優化指令HIDE,大大優化數據庫 [打印本頁]

作者: admin    時間: 2010-11-5 19:28
標題: 優化指令HIDE,大大優化數據庫
找到論壇位置的include/discuzcode.func.php

找到discuzcode.func.php 里面的
$query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$discuz_uid' LIMIT 1"); if($GLOBALS['forum']['ismoderator'] $db->result($query, 0)) {

改為下面的,之後儲存

//$query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$discuz_uid' LIMIT 1");

//if($GLOBALS['forum']['ismoderator'] $db->result($query, 0)) {


global $isposted;
if(!isset($isposted)) {
$query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND authorid='$discuz_uid' LIMIT 1");
$isposted = $db->result($query, 0);

}

if($GLOBALS['forum']['ismoderator'] $isposted) {


這段作用是作,例如妳有十篇文章用了HIDE..用了這一段就可以將查詢減至一個 ,大大優化數據庫




歡迎光臨 比思論壇 (http://bbb-ccc.site/) Powered by Discuz! X2.5