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();
执行操作的是哪个数据表, 就用哪个数据模型
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/13784.html
- 上一篇:Oracle RMAN备份
- 下一篇:Django 模型(数据库)