zfdebug安装使用

一、简介


ZFDebug是一个ZendFramework调试工具条,这个工具条会出现在每个页面的最底部。能够显示页面展示发费时间,内存使用,数据库查询的数量,各变量运行期值,完整的SQL查询语句和查询时间,Zend_Cache和APC的缓存信息,运行异常信息等等。

站点:http://code.google.com/p/zfdebug/

二、安装方法

下载文件之后把ZFDebug\library下的ZFDebug目录 复制到ZF项目的库文件夹下。我的文件目录是这样的



然后把demos下Zend_Application_Bootstrap.php 中的_initZFDebug项目的引导文件Bootstrap.php中。
然后刷新一下网页看一下是否成功。注意一定要开启session会话
三、灵活使用
在实际的使用过程中还要注意下面几点,
在默认的情况下zfdebug只显示三项的调试信息,如果要想显示更多的调试信息类型,就要修改
你项目的Bootstrap.php的_initZFDebug的内容。
例如:

<?php
    protected function _initZFDebug() {
        $autoloader = Zend_Loader_Autoloader::getInstance ();
        $autoloader->registerNamespace ( 'ZFDebug' );
        
        $options = array ('plugins' => array ('Variables', //'File' => array('base_path' => '/path/to/project'),
        'File' => array ('base_path' => APPLICATION_PATH.'/../' ), 'Memory', 'Time', 'Registry', 'Exception' ) );
        
        # Instantiate the database adapter and setup the plugin.
        # Alternatively just add the plugin like above and rely on the autodiscovery feature.
        if ($this->hasPluginResource ( 'db' )) {
            $this->bootstrap ( 'db' );
            $db = $this->getPluginResource ( 'db' )->getDbAdapter ();
            $options ['plugins'] ['Database'] ['adapter'] = $db;
        }
        
        # Setup the cache plugin
        if ($this->hasPluginResource ( 'cache' )) {
            $this->bootstrap ( 'cache' );
            $cache = $this - getPluginResource ( 'cache' )->getDbAdapter ();
            $options ['plugins'] ['Cache'] ['backend'] = $cache->getBackend ();
        }
        
        $debug = new ZFDebug_Controller_Plugin_Debug ( $options );
        
        $this->bootstrap ( 'frontController' );
        $frontController = $this->getResource ( 'frontController' );
        $frontController->registerPlugin ( $debug );
        
        
        // Set a custom timer
        $zfTimer = $debug->getPlugin('Time');
        $zfTimer->mark('Query 1');
    }
?>

 



在默认情况下,zfdebug使用的js文件是http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js,最好修改成本地的,速度快
解决的办法是修改_initZFDebug()的jquery_path变量。
            $options = array(
                'plugins' => array('Variables',
                                   'Memory',
                                   'Time',
                                   'Registry',
                                   'Exception'),
                'jquery_path'=>"http://lcoalhost/zfproject/templates/default/js/jquery.min.js"

            );

核心类  ZFDebug_Controller_Plugin_Debug

效果图:

 

 

四. 失败解决方法:

1.Make sure your APPLICATION_ENV isset to 'development'.
2.Make sure to have a valid layout (with<head>and<body> etc).
3.The basePath option should be APPLICATION_PATH .'/../'.

参考文档: 

http://code.google.com/p/zfdebug/wiki/Installation

http://hi.baidu.com/wuhui/item/0c25c2e5ebefb63c4ddcaf2d

 

丰富的面板截图:

转载于:https://www.cnblogs.com/DavidYan/articles/2532486.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值