qingmvc/qdebug

qdebug: qingmvc 调试模块,qingmvc debug module

dev-master 2018-08-17 10:09 UTC

This package is not auto-updated.

Last update: 2024-04-22 06:17:46 UTC


README

  • 应用调试
  • SQL调试
  • PHP代码调试

怎么使用

  • 只要挂载qdebug拦截器,就开启了qdebug调试工具支持。
  • 一般只在本地开发环境开启该工具,不要在线上环境使用。
//拦截器
'interceptors'=>
[
	//
	'qdebug'=>'\qdebug\DebugInterceptor',
	//或者
	'qdebug'=>
	[
		'class'=>'\qdebug\DebugInterceptor',
		//显示logo
		'showLogo'=>true,
		//是否开启记录
		'on'=>true
	],
]

怎么跳转到qdebug?

  1. 开启qdebug logo : 在右下角会显示蓝色的执行信息。Q 0.1192 s
  2. 点击logo即跳转到qdebug主界面

应用调试

记录应用执行信息:

  • 脚本运行情况:消耗时长,消耗内存
  • 包含了哪些脚本文件
  • 服务器信息: $_GET/$_POST/$_SERVER/$_COOKIE/$_SESSION/$_FILES
  • 类&函数: 常量/constant,类/class,接口/interface,函数/function,trait
  • 回溯&断点:
  • 节点:
  • SQL:sql语句,执行消耗时长,执行消耗内存
  • 控制台信息

自定义调试方法

defined('QDEBUG') && qdebug_console(__METHOD__);
defined('QDEBUG') && qdebug_node(__METHOD__);
//
defined('QDEBUG') && qdebug_node(__METHOD__);
defined('QDEBUG') && qdebug_breakpoint();	

接口

/**
 * 添加控制台信息
 *
 * @param string $info 信息
 */
function qdebug_console($info);
/**
 * 添加节点信息,计算节点间运行时间和内存
 *
 * @param string $name 节点名称
 * @param string $summ 节点描述
 */
function qdebug_node($name,$summ='');
/**
 * 添加断点
 * 
 * @param string $name 断点名称
 */
function qdebug_breakpoint($name='');

ajax提交的跳转无法缓存追踪数据

  • header跳转没有执行到afterCompletion

是否挂载了qdebug组件

//拦截器中定义 define('QDEBUG',true); //判断是否加载qdebug,加载才能使用其函数 defined('QDEBUG') && qdebug_breakpoint('视图');