当前位置:首页 > 数据库 > 正文

Thinkphp 5.0 获取最后执行的SQL

2024-03-31 数据库

 1   
 2          $q=new Question();
 3             $q->save([‘qcount‘=>$qs->qcount 1],[‘id‘=>input(‘qid‘)]);
 4            ///////=========================================
 5         var_dump((new Question())->db()->getLastSql());   //=
 6             ///=================================================
 7             //die;
 8             $stu = new Student();
 9             $res = $stu->save([
10                 ‘qid‘ => input(‘qid‘),
11                 ‘tid‘ => input(‘tid‘),
12                 ‘lock‘ => 1
13             ], [
14                 ‘uname‘ => Session::get(‘uname‘)
15             ]);
16         用的就是
(new Question())->db()->getLastSql();

 

执行操作的是哪个数据表, 就用哪个数据模型

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/13784.html