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