pinguo / php-msf

PHP微服务框架即Micro Service Framework For PHP
GNU General Public License v2.0
1.75k stars 317 forks source link

有个小提议。怎么调试db sql语句? #81

Closed wuchuguang closed 6 years ago

wuchuguang commented 7 years ago
Minner.php
public $debug = false;
public function debug($debug = true){
    $this->debug = $debug;
    return $this;
}

public function go($bindId = null, $sql = null)
    {
        if ($sql == null) {
            $sql = $this->getStatement(false);
        }
        if($this->debug){
            writeln($sql);//打印sql
        }
       ..................
}
viaweb3 commented 7 years ago

可以把SQL记录在日志中,通过日志查看。

wuchuguang commented 7 years ago

是的。

xudianyang commented 7 years ago

我建议还是打在日志里面,写到业务日志,不要由框架直接输出到控制台。

moyee commented 7 years ago

无论是日志或者调试模式可以输出个人觉得都OK