使用zfdebug调试zend framework

来源:互联网 发布:霸刀战神翅膀升级数据 编辑:程序博客网 时间:2024/05/28 05:13

插件的名字叫ZFDebug-1.5

把zfdebug\library下面的文件夹ZFDebug拷贝到项目的library目录下面

写一个函数放在Bootstrap.php里面(适用于zend framework 1.8以上)

zfdebug官方下载地址:http://code.google.com/p/zfdebug/downloads/detail?name=ZFDebug-1.5.zip

打开页面有点久。

下面是函数

protected function _initZFDebug()
    {
         $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->registerNamespace('ZFDebug');
    
    $options = array(
        'plugins' => array('Variables', 
                           '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);
    }

原创粉丝点击