Home >Backend Development >PHP Tutorial >thinkphp3 gets the latest sql statement
This article mainly introduces how to get the latest sql statement in thinkphp3, which has a certain reference value. Now I share it with everyone. Friends in need can refer to it
thinkphp 3 Get the latest sql Statement
/** * @title 获取最近的sql语句 * @author lyj [author] [2018-07-06] * @param integer $type [类型 0 打印语句 不为0 返回语句] * @return [type] [description] */function getsqlstr($type = 0) { if($type === 0){ echo '您要的SQL: <br> <h5 style="color:#EE1616;">' . M()->getLastSql() . '<h5>'; echo '<br>'; }else{ $res = M()->getLastSql(); return $res; } }
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
The above is the detailed content of thinkphp3 gets the latest sql statement. For more information, please follow other related articles on the PHP Chinese website!