php 输出 sql语句

 

第一种方法

$data = M('news')->field("title,date_format(postdate,'%Y-%m-%d') as postdate,content")->where($map)->limit(1)->find();
var_dump( M('news')->_sql());

 

注: 把 this->display()去掉

 

 

 

第二种方法:

$resultsql= $model-> getLastSql();

posted @ 2015-01-19 16:49  Coding_Yong  阅读(2075)  评论(0编辑  收藏  举报