Table of Contents
" >2. [PHP]代码 
Home php教程 PHP源码 将ZFDebug加入到ZF的项目中

将ZFDebug加入到ZF的项目中

May 25, 2016 pm 05:12 PM

将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(&#39;ZFDebug&#39;);
		
		//initialized Front Controller
		$bootstrap = $this->getBootstrap();
		$bootstrap->bootstrap(&#39;frontController&#39;);
		$frontController = $bootstrap->getResource(&#39;frontController&#39;);

		if ($iniOptions[&#39;enabled&#39;] && &#39;development&#39; == APPLICATION_ENV) {
			//set ZFDebug options
			$options = array(
				&#39;jquery_path&#39; => &#39;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#39;, 
				&#39;plugins&#39; => array(
					&#39;Variables&#39;, 
					&#39;File&#39; => array(&#39;basePath&#39; => APPLICATION_PATH .&#39;/..&#39;), 
					&#39;Memory&#39;, 
					&#39;Time&#39;, 
					&#39;Registry&#39;,
					&#39;Exception&#39;
				),
			);

			//add cache option if specified
			if($bootstrap->hasPluginResource(&#39;cache&#39;)){
				$bootstrap->bootstrap(&#39;cache&#39;);
				$cache = $bootstrap->getPluginResource(&#39;cache&#39;)->getBackend();
	            $options[&#39;plugins&#39;][&#39;Cache&#39;][&#39;backend&#39;] = $cache; 
			}
			
	        // add db option if specified
	        if ($bootstrap->hasPluginResource(&#39;db&#39;)) {
	            $bootstrap->bootstrap(&#39;db&#39;);
	            $db = $bootstrap->getPluginResource(&#39;db&#39;)->getDbAdapter();
	            $options[&#39;plugins&#39;][&#39;Database&#39;][&#39;adapter&#39;] = $db;
	        }			
			
			$debug = new ZFDebug_Controller_Plugin_Debug($options);
			$frontController->registerPlugin($debug);
		}
	}

}
Copy after login

2. [PHP]代码

在application.ini中加入

[development : production]
resources.zfdebug.enabled = 1
Copy after login

 以上就是将ZFDebug加入到ZF的项目中的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)