getOptions();
//set ZFDebug to autoload
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader -> registerNamespace('ZFDebug');
//initialized Front Controller
$bootstrap = $this->getBootstrap();
$bootstrap->bootstrap('frontController');
$frontController = $bootstrap->getResource('frontController');
if ($iniOptions['enabled'] && 'development' == APPLICATION_ENV) {
//set ZFDebug options
$options = array(
'jquery_path' => 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',
'plugins' => array(
'Variables',
'File' => array('basePath' => APPLICATION_PATH .'/..'),
'Memory',
'Time',
'Registry',
'Exception'
),
);
//add cache option if specified
if($bootstrap->hasPluginResource('cache')){
$bootstrap->bootstrap('cache');
$cache = $bootstrap->getPluginResource('cache')->getBackend();
$options['plugins']['Cache']['backend'] = $cache;
}
// add db option if specified
if ($bootstrap->hasPluginResource('db')) {
$bootstrap->bootstrap('db');
$db = $bootstrap->getPluginResource('db')->getDbAdapter();
$options['plugins']['Database']['adapter'] = $db;
}
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$frontController->registerPlugin($debug);
}
}
}2. [PHP]代码
在application.ini中加入 [development : production] resources.zfdebug.enabled = 1
以上就是将ZFDebug加入到ZF的项目中的内容,更多相关内容请关注PHP中文网(www.php.cn)!









