Home > php教程 > php手册 > Laravel SQL语句记录方式(推荐),laravelsql

Laravel SQL语句记录方式(推荐),laravelsql

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 08:38:15
Original
1014 people have browsed it

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);

});
Copy after login

以上这篇Laravel SQL语句记录方式(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持帮客之家。

source:php.cn
Statement of this Website
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
Latest Issues
Composer cannot install laravel
From 1970-01-01 08:00:00
0
0
0
Laravel Space/laravel-backup cannot be installed
From 1970-01-01 08:00:00
0
0
0
Laravel 5.1 Login laravel comes with it No more
From 1970-01-01 08:00:00
0
0
0
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template