ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 如何关闭Debug栏 在 `Config/App.php` 中的地277行左右:有这么一段: ```php /* |-------------------------------------------------------------------------- | Debug Toolbar |-------------------------------------------------------------------------- | The Debug Toolbar provides a way to see information about the performance | and state of your application during that page display. By default it will | NOT be displayed under production environments, and will only display if | CI_DEBUG is true, since if it's not, there's not much to display anyway. */ public $toolbarCollectors = [ 'CodeIgniter\Debug\Toolbar\Collectors\Timers', 'CodeIgniter\Debug\Toolbar\Collectors\Database', 'CodeIgniter\Debug\Toolbar\Collectors\Logs', 'CodeIgniter\Debug\Toolbar\Collectors\Views', // 'CodeIgniter\Debug\Toolbar\Collectors\Cache', 'CodeIgniter\Debug\Toolbar\Collectors\Files', 'CodeIgniter\Debug\Toolbar\Collectors\Routes', 'CodeIgniter\Debug\Toolbar\Collectors\Events', ]; ``` 从注释中可以看到,这是 `CI_DEBUG` 在控制着,它在什么地方呢?通过Sublime Text搜索得知,在几个控制版本的文件中,下方表示文件、行数、代码: ```text E:\xampp\htdocs\application\Config\Boot\development.php: 31 */ 32 33: define('CI_DEBUG', 1); 34 E:\xampp\htdocs\application\Config\Boot\production.php: 20 */ 21 22: define('CI_DEBUG', 0); 23 E:\xampp\htdocs\application\Config\Boot\testing.php: 31 */ 32 33: define('CI_DEBUG', 1); 34 ``` 如果直接将环境改为`production`,那就自然没有了,但像我这种,既想保持`development`又不想关闭`Debug Toolbar`的,就可以在`development.php`中将参数设置为`0` (完)