数据库操作之问题排查方法(DB) 思路是在网页端打印出sql查询语句,然后复制放在mysql终端执行,看是否能查询出语句 //方法1:加入fetchSql(),括号内可加true或false使其有效或无效 $result = DB::table("mall_demo")->where("id",4)->fetchSql()->find(); //方法2:固定用法 $result = DB::table("mall_demo")->where("id",4)->find(); echo Db::getLastSql();exit();