


[Mr. Mai] Laravel SQL statement recording method, laravelsql_PHP tutorial
Jul 12, 2016 am 08:51 AM[Mr. Mai] Laravel SQL statement recording method, laravelsql
Print the sql statement and output it directly after you execute the SQL statement
Method 1:
$queries = DB::getQueryLog();
$a = end($queries);
$tmp = str_replace('?', '"'.'%s'.'"', $a["query"]);
echo vsprintf($tmp, $a['bindings']);
exit;
Method 2: Pay attention to put it above routes.php
Event::listen('illuminate.query',function($query){
var_dump($query);
});

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use sql statement to query the storage structure of mysql database

How to export the queried data in navicat

How to execute sql statement in mysql database

How to solve mysql database initialization failure

MySQL transaction processing: the difference between automatic submission and manual submission

Comparison of similarities and differences between MySQL and PL/SQL
