ThinkPHP开发技巧集锦(3):开启数据库sql日志
2022-11-24 11:10:29
190
{{single.collect_count}}

1、config.php

'app_debug'=> true,'log'=> [// 日志记录方式,内置 file socket 支持扩展'type'=> 'File', //设置,test为关闭// 日志保存目录'path'=> LOG_PATH,// 日志记录级别'level' => ['sql'], //设置],

2、database.php

 'debug' => true,

注意:

多数时候,关闭记录日志(type=>'test'),只需要记录sql日志即可,因此可在 public\index.php中开启sql日志记录

\think\Log::init(['type' => 'File','path' => LOG_PATH,'level' => ['sql']]);

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}