获取sql语句

1、$model->_sql();
  方法实际执行的就是 $model->getLastSql();
2、fetchSql
  fetchSql用于直接返回SQL而不是执行查询,适用于任何的CURD操作方法。 例如:
  $result = M('User')->fetchSql(true)->find(1);
  输出result结果为: SELECT * FROM think_user where id = 1
原文地址:https://www.cnblogs.com/crazytata/p/8427870.html