Table of Contents
[Mr. Mai] Laravel SQL statement recording method, laravelsql
Home Backend Development PHP Tutorial [Mr. Mai] Laravel SQL statement recording method, laravelsql_PHP tutorial

[Mr. Mai] Laravel SQL statement recording method, laravelsql_PHP tutorial

Jul 12, 2016 am 08:51 AM
sql statement

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

});

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1129312.htmlTechArticle[Mr. Mai] Laravel SQL statement recording method, laravelsql prints sql statement, and outputs the method directly after you execute the SQL statement 1: $queries = DB::getQueryLog(); $a = end($queries); $tmp = str...
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

Hot Article

Hot Article

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use the iif function in excel How to use the iif function in excel Mar 20, 2024 pm 06:10 PM

How to use the iif function in excel

How to query oracle database logs How to query oracle database logs Apr 07, 2024 pm 04:51 PM

How to query oracle database logs

How to use sql statement to query the storage structure of mysql database How to use sql statement to query the storage structure of mysql database Apr 14, 2024 pm 07:45 PM

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

How to export the queried data in navicat How to export the queried data in navicat Apr 24, 2024 am 04:15 AM

How to export the queried data in navicat

How to execute sql statement in mysql database How to execute sql statement in mysql database Apr 14, 2024 pm 07:48 PM

How to execute sql statement in mysql database

How to solve mysql database initialization failure How to solve mysql database initialization failure Apr 14, 2024 pm 07:12 PM

How to solve mysql database initialization failure

MySQL transaction processing: the difference between automatic submission and manual submission MySQL transaction processing: the difference between automatic submission and manual submission Mar 16, 2024 am 11:33 AM

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

Comparison of similarities and differences between MySQL and PL/SQL Comparison of similarities and differences between MySQL and PL/SQL Mar 16, 2024 am 11:15 AM

Comparison of similarities and differences between MySQL and PL/SQL

See all articles