---
title: "TP5 调试"
author: "onestopweb"
date: "2017-07-18T17:40:31Z"
tags: []
categories: ["Web前端"]
slug: "tp5"
draft: false
lastmod: "2017-07-18T17:47:05Z"
id: 2384891
url: "https://onestopweb.iteye.com/blog/2384891"
---

config.php 修改为下面的两个参数：

```
// 应用Trace
'app_trace'              => true,
'trace'                  => [
	// 内置Html Console 支持扩展
	'type' => 'Console',
],
```

 

controller/Index.php 三种调试方法，推荐使用 trace

```
<?php 
namespace app\index\controller;

class Index
{
    public function index()
    {
        //dump 变量调试输出
        dump(['a', 'b', 'c']);
        //halt 变量调试并中断输出
        //halt方法的作用和dump一样，只是在输出变量之后会中断当前程序的执行
        //halt(['a', 'b', 'c']);
        trace(['aaa', 'bbb', 'ccc']);
    }
}
```

 

效果图：  
![](http://dl2.iteye.com/upload/attachment/0126/1196/78c72535-fb02-37a7-b23e-77dc58aa07de.png)