ECSHOP 的 DEBUG_MODE 功能
在很多程式當中都有判斷 DEBUG_MODE 的部分, 對於想要修改 ECSHOP 系統的人能弄清楚的話會有所幫助。設定的位置就在 data/config.php 中,請在開頭加入[code]
//除錯用開關
define('DEBUG_MODE', 0
//+ 1 //錯誤報告全部顯示
//+ 2 //停用 Smarty Cache (改前台樣版時好用)
//+ 4 //啟用 lib.debug
//+ 8 //紀錄資料庫SQL查詢
);[/code]想要開啟某個功能就將左側註解符號移除,以下是從程式當中分析出來的狀況:
[b]DEBUG_MODE & 1 = True 時[/b]
前台錯誤報告模式 includes/init.php
後台錯誤報告模式 admin/includes/init.php
error_reporting(E_ALL);
[b]DEBUG_MODE & 1 = False 時[/b]
前台錯誤報告模式 includes/init.php
後台錯誤報告模式 admin/includes/init.php
error_reporting(E_ALL ^ E_NOTICE);
[b]DEBUG_MODE & 2 = True 時[/b]
前台
$smarty->direct_output = true;
$smarty->force_compile = true;
後台
$smarty->force_compile = true;
會忽略讀取快取檔案功能 [includes/lib_base.php read_static_cache()]
會忽略產生快取檔案功能 [includes/lib_base.php write_static_cache()]
[b]DEBUG_MODE & 2 = False 時[/b]
前台
$smarty->direct_output = false;
$smarty->force_compile = false;
[b]DEBUG_MODE & 4 = True 時[/b]
前台 includes/init.php
後台 admin/includes/init.php
include(ROOT_PATH . 'includes/lib.debug.php');
會產生 log.txt 檔案 [includes/lib_base.php log_write()]
[b]DEBUG_MODE & 8 = True 時[/b]
紀錄查詢的 SQL [includes/cls_mysql.php query()]
會存放在 data/mysql_query_hash_Y_M_D.log
頁:
[1]