Thinkphp 5.0 获取最后执行的SQL


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

 

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM