前言介紹
- 這款 WordPress 外掛「Debug Toolkit」是 2019-03-08 上架。
- 目前有 50 個安裝啟用數。
- 上一次更新是 2019-03-11,距離現在已有 2246 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 4.9 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 5.6 以上。
- 有 13 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
debug | print_r | debugger | var_dump | backtrace |
內容簡介
Debug Toolkit 讓除錯代碼變得更輕鬆且回味無窮,它提供了交互式和有用的工具:
更好的 PHP 錯誤介面(來自Whoops)
更好的變數檢查 - 無需使用 var_dump、print_r 或 X-debug
回溯程序執行順序的交互式方式
來自 Whoops 的更好的 PHP 錯誤介面
內建的 PHP 錯誤容器非常基本,並且不像它應有的那麼有用。而且,它實在不好看,你不同意嗎?
Whoops 為你提供了一個很酷的介面,能幫助你進行交互,看起來也很漂亮。 它還有一些功能:
提供錯誤消息並提供到 Google、DuckDuckGo 和 Stack Overflow 的搜索鏈接。
顯示錯誤發生的實際代碼。
提供交互式調用堆棧。 點擊每個調用堆棧,在查看器面板中顯示實際代碼。
環境和詳細資訊,包括 GET Data、POST Data、Files、Cookie、Session、 Server/Request Data、環境變數和註冊處理程序。
在此影片中觀看這些工具的操作:
更好的變數檢查
雖然 X-debug 很強大,但設置和執行可能很困難,因此通常需要在瀏覽器中輸出變數的數據。 但是,PHP 的內建顯示 var_dump 和 print_r 的功能非常基本。
這個外掛包含了兩個非常流行的變數傾印工具:
Symfony 的 VarDumper
Kint - 現代而強大的 PHP 調試助手
VarDumper 提供了一個簡單容器,用於顯示您放置的位置。
另一方面,Kint 提供了一個更強大的界面,可以提供更多信息,例如打印傳遞給它的表達式、數據類型、內存大小和值。
為了使它更加容易,以下實用程序函數可供您在代碼中使用:
用於檢查變數值的可用函數
讓我們探索通過此外掛可用的函數。 我們將使用變數檢查器來傾印 global $post。
註:您可以傳遞任何變數或返回值的函數。
傾印給定的變數:
global $post;
// VarDumper
vdump( $post );
// Kint
dump( $post );
傾印給定的變數,然後退出程序的執行:
global $post;
// VarDumper
vdump_and_die( $post );
// Kint
dump_and_die( $post );
此外,如果您喜歡使用較短的函數名稱,還有簡寫函數可供您使用:
vd() 是 vdump() 的簡寫
vdd() 和 vdd() 是 vdump_and_die() 的簡寫
d() 是 dump() 的簡寫
dd() 和 ddd() 是 dump_and_die() 的簡寫
追踪調用堆棧
在調試時,有時需要查看導致程序某個點的函數調用順序。 PHP 提供了一個回溯,可以從呼叫函數的點回溯程序的執行順序。
為了讓回溯更容易,此外掛為你提供了
原文外掛簡介
Debug Toolkit makes debugging your code easier and more enjoyable. It provides you with interactive and helpful tools:
Better PHP error interface from (Whoops)
Better variable inspection – no need to use var_dump, print_r, or X-debug
An interactive way to back trace the program’s execution order
Better PHP Error Interface from Whoops
The built-in PHP error container is basic and not as helpful as it could be. On top of that, it’s rather ugly. Wouldn’t you agree?
Whoops gives you a cool interface that is helpful, interactive, and quite nice to look at. Some features:
Provides the error message and links to search Google, DuckDuckGo, and Stack Overflow.
Shows the actual code where the error occurred.
Provides an interactive call stack. Click each and the actual code appears in the viewer panel.
Environment and details including GET Data, POST Data, Files, Cookie, Session, Server/Request Data, Environment Variables, and Registered Handlers.
See the tools in action in this video
Better Variable Inspection
Though X-debug is powerful, it can be difficult to set up and run. For that reason, it’s common to dump or print out the variable to browser. But the built-in display for the PHP var_dump and print_r is basic.
This plugin includes both two very popular variable dumper tools:
VarDumper from Symfony
Kint – a modern and powerful PHP debugging helper
VarDumper provides a simple container that displays where you place it.
On the other hand, Kint provides a more powerful interface that gives you more information such as printing out the expression that was passed into it, the data type, memory size, and the value.
To make it even easier, the following utility functions are available for you to use in your code:
Available Functions for Inspecting Variable Values
Let’s explore the functions that are available for you through this plugin. We’ll use the variable inspectors to dump global $post.
Note: You can pass in any variable or function that returns a value.
Dumps the given variable(s):
global $post;
// VarDumper
vdump( $post );
// Kint
dump( $post );
Dumps the given variable(s) and then exits the program’s execution:
global $post;
// VarDumper
vdump_and_die( $post );
// Kint
dump_and_die( $post );
In addition, there are alias (shorthand) functions available for you if you prefer shorter function names:
vd() is an alias for vdump()
vdd() and vdd() are aliases for vdump_and_die()
d() is an alias for dump()
dd() and ddd() are aliases for dump_and_die()
Tracing Call Stack
When debugging, there are times when you need to see the order in which functions were called that lead to a certain point in the program. PHP offers a backtrace that traces back the execution order from the point when the function is invoked.
To make backtracing easier, this plugin provides you with a trace() function and combines it with the variable inspect functions.
For example, if you wanted to trace the call stack to the start of the loop in your theme’s functions.php file, you could use this code:
add_action( 'loop_start', function() {
trace();
} );
Available Trace Functions
Place these functions at the point where you want to trace the call stack.
trace();
trace_vdump(); – Combines trace() and vdump()
trace_dump(); – Combines trace() and dump()
trace_vdump_and_die(); – Combines trace() and vdump_and_die()
trace_dump_and_die(); – Combines trace() and dump_and_die()
In addition, there are alias (shorthand) functions available for you if you prefer shorter function names:
tracevd(); – Combines trace() and vd()
traced(); – Combines trace() and d()
tracevdd(); – Combines trace() and vdd()
tracedd(); – Combines trace() and dd()
tracevddd(); – Combines trace() and vddd()
traceddd(); – Combines trace() and ddd()
Admin Bar
“DEBUG ACTIVE” indicator displays in the WordPress admin bar to alert you when the plugin is active.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Debug Toolkit」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
Debug This 》Debug This是由友好Macho Themes團隊打造、維護和運營的獨立外掛程式。, 對於管理員、開發人員和支援人員,Debug This提供了大量的有關WordPress安裝的信息,...。
Kint Debugger 》, 此外掛正在等待領養。, , Kint Debugger 是一個簡單的包裝工具,使用Kint,這是一個偵錯工具,可以輸出有關於變數和追踪的資訊,並以一個有樣式、可摺疊的...。
F12-Profiler 》此外掛會追蹤每個外掛、JavaScript 和 CSS 檔案的載入時間,, 協助您優化 WordPress 網站的效能。此外掛將協助您找出導致網頁速度變慢的, 是哪個外掛或資源。...。
DP Debug Menu 》一種快速且小型的調試器,整合到 WordPress 管理列中,用於識別用於顯示當前頁面的模板。, 它是為了快速調試舊項目或其他人的工作而建立的。, 在下拉列表中它...。
WP Tracy 》Tracy 是一個來自 Nette PHP 框架的優秀 PHP 偵錯器工具列。, WP Tracy 將 Tracy 簡單地導入 WordPress 並進行整合(用於測試環境)。, 當啟用 WP Tracy 後,...。
Kint PHP Debugger 》這款 WordPress 外掛是 Kint PHP Debugger 的封裝,版本為 1.x。現在,您可以直接使用 d(),而無需使用 var_dump() 或 print_r(),也不需要任何格式化。, 在...。
wp-dBug 》這個外掛基本上是 PHP debugging 的 dBug 類別 (http://dbug.ospinto.com) 包裝器,由 Kwaku Otchere 編寫。, 你可以呼叫 wp_dbug( $variable ) 來取得清晰、...。
Deprecation Checker 》WP_DEBUG 功能良好,但無法包括某些頁面載入時未加載的所有主題/外掛程式檔。Deprecation Checker 可讓您查看所有已停用的功能,包含路徑、行號、停用函數名...。
Open in Social Debugger 》此外掛會在管理列中加入「打開社交媒體偵錯器」的連結。點擊此連結即可在 Facebook 分享偵錯器中檢查當前頁面或文章。, 此外掛適用於頁面和文章,並可以在前...。
debugWP 》, DebugWp 會在您的 WordPress 網站底部放置一個新的工具列,只有管理員可以看到,顯示您正在查看的任何特定頁面的資訊。, WordPress 偵錯 (Debug) 資訊包括:...。
Debugger 》您可以使用此外掛手動記錄數據或捕獲 WordPress 行動的日誌。您可以捕獲負載時間、記憶體、backrace、數據轉儲、URL 和服務器 IP。, 這是為使用 wp-config.ph...。
Debug Tool 》這是一個幫助開發人員和管理員更輕鬆地取得訊息的工具。, 如果 WP_DEBUG 為 true,則在前端,調試欄會對所有人都可用。如果你是管理員,則可以在任何頁面上打...。
What's running 》僅用於開發!, 現在支援OPcache內存消耗, 這個外掛會在正常的WordPress HTML輸出後,HTML標籤關閉後,輸出帶有彩色標記的文件名稱、記憶體消耗或檔案大小。這...。
Machine Language 》切換管理頁面上的人類和機器標籤(ID-s)。, 僅供開發使用!, 本外掛顯示幾乎所有表單字段的ID,包括類似於wp-admin/options.php的選擇框、複選框和單選按鈕。,...。
G Debugger 》G Debugger整合了Gutenberg區塊編輯器,添加了有用的視覺調試工具,以協助區塊開發。, 在這個初步版本中,目前的功能包括:, , 「屬性檢查器」顯示區塊當前屬...。