首页 > php教程 > PHP源码 > 正文

将ZFDebug加入到ZF的项目中

PHP中文网
发布: 2016-05-25 17:12:35
原创
1453人浏览过

将zfdebug加入到zf的项目中

<?php
/**
 * ZFDebug resource
 *
 * @copyright  Copyright (c) 2011 Ricky Feng (http://code.google.com/p/rphp4zf)
 * @license    New BSD License
 */

class RPHP_Application_Resource_ZFDebug extends Zend_Application_Resource_ResourceAbstract
{
	public function init()
	{
		//get ini file options
		$iniOptions = $this->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)!

在Android
在Android

本文档主要讲述的是在Android-Studio中导入Vitamio框架;介绍了如何将Vitamio框架以Module的形式添加到自己的项目中使用,这个方法也适合导入其他模块实现步骤。希望本文档会给有需要的朋友带来帮助;感兴趣的朋友可以过来看看

在Android 0
查看详情 在Android

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号