ycheukf/debug

zf2 的调试和数据库分析模块

dev-developing 2013-07-27 07:16 UTC

This package is not auto-updated.

Last update: 2024-09-23 15:21:41 UTC


README

版本 0.0.1 由 ycheukf@gmail.com 创建

简介

YcheukfDebug 是一个为 zend framework 2 定制的调试模块。此模块会将变量和 SQL 信息输出到缓存文件中,而不是直接打印出来。

功能/目标

  • 以 var_dump 的方式输出变量
  • 输出数据库分析(支持多种数据库适配器)
  • 当请求 AJAX 时,调试信息不会被重写

要求

安装

通过 git 安装

克隆此仓库 git clone https://github.com/ycheukf/debug.git

通过 Composer 安装

将以下内容添加到您的 composer.json 中的 "require" 部分:"ycheukf/debug": "dev-master"

运行命令:php composer.phar update

使用方法

1: 将模块 'YcheukfDebug' 添加到您的 application.config.php

return array(
    'modules' => array(
        'YcheukfDebug',
        'Application',
    ),
);

2: 使用以下代码作为 var_dump

	\YcheukfDebug\Model\Debug::dump($var, 'memo');

3: 在 http://yourzf2project/public/index.php/ycfdebug 检查输出

高级使用

如果一个项目有多个数据库适配器和主从适配器,您需要在代码中附加一个新的事件 'YcheukfDebugSetProfiler'。就像在 vendor/ycheukf/debug/Module.php 中的 'setAttach' 函数中的代码一样。