搜尋
首頁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 Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

mPDF

mPDF

mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),