Home > Backend Development > PHP Tutorial > thinkphp 3.1.2 About the method of printing sql statement

thinkphp 3.1.2 About the method of printing sql statement

WBOY
Release: 2023-03-01 20:18:02
Original
2096 people have browsed it

<code> M('user')->where('user_id = %d', $v['user_id'])->find()</code>
Copy after login
Copy after login

Excuse me, there is such a data query method in thinkphp3.1.2. How to print out the native sql statement it executes?

Reply content:

<code> M('user')->where('user_id = %d', $v['user_id'])->find()</code>
Copy after login
Copy after login

Excuse me, there is such a data query method in thinkphp3.1.2. How to print out the native sql statement it executes?

I read the wrong question

<code>echo  M("user")->getLastSql();</code>
Copy after login

M('user')->fetchsql(true)->where('user_id = %d', $v['user_id'])->find()

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template