多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
1. 首先引入Log类:`use think\Log;` 2. 其次在调用模型查询或者修改方法之后调用日志记录调试执行的SQL语句 ~~~ <?php namespace app\index\model; use app\common\model\RemoteModel; use think\Config; use think\Log; class DCharacter extends RemoteModel { /** * 等级人数计算 * * @param int $level 等级 * @return int 等级分布人数 */ public function doLevelCount($level) { $map['level'] = $level; $count = $this->where($map)->count('level'); Log::info(self::getLastSql()); //调试SQL return $count; } } ~~~