Laravel SQL语句记录方式(推荐),laravelsql
打印sql语句,直接在你执行SQL语句后输出
方法一:
$queries = DB::getQueryLog();
$a = end($queries);
$tmp = str_replace('?', '"'.'%s'.'"', $a["query"]);
echo vsprintf($tmp, $a['bindings']);
exit;
方法二: 注意 放在routes.php上面
Event::listen('illuminate.query',function($query){
var_dump($query);
});
以上这篇Laravel SQL语句记录方式(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持帮客之家。
http://www.bkjia.com/PHPjc/1133071.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1133071.htmlTechArticleLaravel SQL语句记录方式(推荐),laravelsql 打印sql语句,直接在你执行SQL语句后输出 方法一: $queries = DB::getQueryLog(); $a = end($queries); $tmp = str_...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn