你先修复一下 0ms的问题 /HY/HY_SQL.php 104行处 public function query($query)
{
if ($this->debug_mode) {
echo $query;
$this->debug_mode = false;
return false;
}
array_push($this->logs, $query);
$re = $this->pdo->query($query);
if (C('DEBUG_PAGE')) {
$a = microtime(TRUE);
DEBUG_SQL::SQL_LOG($query . ' [耗时] ' . round(microtime(TRUE) - $a, 4) . 'ms');
}
return $re;
}
改为 public function query($query)
{
if ($this->debug_mode) {
echo $query;
$this->debug_mode = false;
return false;
}
array_push($this->logs, $query);
$a = microtime(TRUE);
$re = $this->pdo->query($query);
if (C('DEBUG_PAGE')) {
DEBUG_SQL::SQL_LOG($query . ' [耗时] ' . round(microtime(TRUE) - $a, 4) . 'ms');
}
return $re;
}
接着下面的exec函数 public function exec($query)
{
if ($this->debug_mode) {
echo $query;
$this->debug_mode = false;
return false;
}
array_push($this->logs, $query);
$re = $this->pdo->exec($query);
if (C('DEBUG_PAGE')) {
$a = microtime(TRUE);
DEBUG_SQL::SQL_LOG($query . ' [耗时] ' . round(microtime(TRUE) - $a, 4) . 'ms');
}
return $re;
}
改为 public function exec($query)
{
if ($this->debug_mode) {
echo $query;
$this->debug_mode = false;
return false;
}
array_push($this->logs, $query);
$a = microtime(TRUE);
$re = $this->pdo->exec($query);
if (C('DEBUG_PAGE')) {
DEBUG_SQL::SQL_LOG($query . ' [耗时] ' . round(microtime(TRUE) - $a, 4) . 'ms');
}
return $re;
}
这是我之前做耗时 的一个if 失误
|