> ## Documentation Index
> Fetch the complete documentation index at: https://discuz.p.cafe/llms.txt
> Use this file to discover all available pages before exploring further.

# DeBug模式

## **面向对象**

有一定 PHP、MySQL 基础的站长，程序开发者。

## **作用**

* 可以明细地列出当前页面的查询，具体查询出现的文件和时间。并且有查询的 `explain` 信息，便于检查哪里出现了慢查询。
* 可以查看当前页面内存使用情况。
* 可以列出当前页面 `$_G` 变量中的内容。
* 可以列出当前页面的 `cookie` 内容。
* 可以查看当前浏览器的信息，`User Agent` 等。

## **所需文件**

将 `function_debug.php` 放到 `source/function` 目录下。

## **修改配置文件**

修改 `config/config_global.php`，在 `$_config = array();` 后加入一行：

```
$_config['debug'] = 1;
```

则，每个页面都将开启 `debug` 模式。

如果修改为：

```
$_config['debug'] = 'debug';
```

则不是每个页面都显示 `debug` 信息，只有在 URL 后面加上 `&debug=debug` 才会显示，这就可以避免普通用户也看到 `debug` 信息了。

## **DeBug 信息解释**

| **项目** | **说明**                                                                    |
| :----- | :------------------------------------------------------------------------ |
| 文件版本   | Discuz! X3.5 20230316                                                     |
| ModID  | forum::index                                                              |
| 包含     | \[文件列表] 51 in 0.054800s                                                   |
| 服务器环境  | WINNT, Apache/2.4.23 (Win32) OpenSSL/1.0.2j mod\_fcgid/2.3.9 MySQL/5.7.26 |
| 内存     | 3,425,856 bytes, 峰值 3,566,816 bytes                                       |
| SQL    | [SQL列表](#) 18(discuz\_table: 21, Using filesort: 4) in 0.130452s          |
| 客户端    | firefox:true chrome:112.0.0.0 safari:537.36 mozilla:5.0 webkit:537.36     |
