検索
ホームページphp教程PHP源码将ZFDebug加入到ZF的项目中

将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);
		}
	}

}

2. [PHP]代码 

在application.ini中加入

[development : production]
resources.zfdebug.enabled = 1

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

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

VSCode Windows 64 ビットのダウンロード

VSCode Windows 64 ビットのダウンロード

Microsoft によって発売された無料で強力な IDE エディター