💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1. 设置数据库调试模式:`config.php` ~~~ <?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- return [ // +---------------------------------------------------------------------- // | 应用设置 // +---------------------------------------------------------------------- // 应用命名空间 'app_namespace' => 'app', // 应用调试模式 'app_debug' => true, ~~~ 2. 查看SQL记录 如果开启了数据库的调试模式的话,可以在日志文件(或者设置的日志输出类型)中看到详细的SQL执行记录以及性能分析。 下面是一个典型的SQL日志: ~~~ [ SQL ] SHOW COLUMNS FROM `think_action` [ RunTime:0.001339s ] [ EXPLAIN : array ( 'id' => '1', 'select_type' => 'SIMPLE', 'table' => 'think_action', 'partitions' => NULL, 'type' => 'ALL', 'possible_keys' => NULL, 'key' => NULL, 'key_len' => NULL, 'ref' => NULL, 'rows' => '82', 'filtered' => '100.00', 'extra' => NULL, ) ] [ SQL ] SELECT * FROM `think_action` LIMIT 1 [ RunTime:0.000539s ] ~~~