打印出最后执行的mysql 语句

db.php 文件中添加

public function getlastsql(){
return $this->sql;
}

入口文件中添加,公共方法

function getlastsql(){
include '../cmstop/framework/factory.php';
$db = & factory::db();
return $db->getlastsql();
}

function mylog1($input){

$file = '../mylog1.txt';
file_put_contents($file,'执行时间:'.date('Y-m-d H:i:s',time())." ".$input." ",FILE_APPEND);

}

原文地址:https://www.cnblogs.com/bj-tony/p/5367066.html