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

thinkphp 3.1.2 About the method of printing sql statement

WBOY
WBOYOriginal
2016-12-01 00:26:042077browse

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

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>

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>

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

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