[WordPress] 外掛分享: WP PHP Console

首頁外掛目錄 › WP PHP Console
WordPress 外掛 WP PHP Console 的封面圖片
600+
安裝啟用
★★★★
4.7/5 分(19 則評價)
1955 天前
最後更新
問題解決
WordPress 3.6.0+ PHP 5.6+ v1.6.0 上架:2015-01-17

內容簡介

PHP Console 讓你可以透過 Google Chrome 擴充元件 PHP Console 和 PHP Console 伺服器程式庫 處理 PHP 錯誤和例外、輸出變數、遠端執行 PHP 程式等等多種任務。

這個 PHP Console 的實作是一個方便的工具,使你可以直接從終端機中測試任何 WordPress 用的函數或類別(包括你啟用的主題或外掛所引進的),並從 Chrome JavaScript 控制台中檢查結果、捕獲錯誤和警告,連同呼叫堆疊追蹤。換言之,除了除錯外,你還可以直接從終端機執行 PHP 或 WordPress 特定的 PHP 代碼,並將 PHP 變數與你正常的 JavaScript 調試和測試的 Chrome Dev Tools JavaScript 控制台一起列印。保持一切在一個地方,不需要離開瀏覽器檢查日誌或在 PHP 檔案上編寫臨時的 PHP 測試代碼並刷新你的瀏覽器頁面。

注意:使用此外掛需要 PHP 版本 5.6.0 或以上。

如需支援和拉取請求,請參閱 WP PHP Console GitHub 存儲庫,閱讀該處的說明 - 謝謝。

使用方法

在輸入 WP PHP Plugin 密碼後,你的瀏覽器地址欄應顯示一個黃色的「鑰匙」圖示,如果單擊它,將提示你輸入之前設置的密碼。
「鑰匙」圖示將變成一個「終端機」圖示,單擊它可打開 PHP Console eval & options 表單。

在輸入正確的密碼後,你可以在 PHP Console eval & options 表單中使用 Eval Terminal,運行任何 PHP 代碼,包括 WordPress 的函數:在黑色的 Eval 終端機屏幕中輸入一行或多行 PHP 代碼,按下 Ctrl+Enter,並在 Chrome Dev Tools JavaScript 控制台中查看結果。
結果包括輸出、返回值和網絡伺服器執行時間。

在伺服器上的 PHP 代碼中,你可以調用 PHP Console debug 陳述式,例如PC::debug($var, $tag)將會在 JavaScript 控制台中列印出 PHP 變數,並可以透過從瀏覽器地址欄中打開 PHP Console eval & options 表單篩選選定的標記。

在 JavaScript 控制台中,你會看到任何 "PC::debug()" 訊息、PHP 錯誤、警告、注意事項及選擇性堆疊追蹤,這些將有助於調試你的外掛或主題。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.6.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WP PHP Console」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

PHP Console allows you to handle PHP errors & exceptions, dump variables, execute PHP code remotely and many other things using Google Chrome extension PHP Console and PHP Console server library.

This implementation of PHP Console is a handy tool to make it easier to test on the fly any WordPress specific function or class (including those introduced by your active theme and plugins!) from a terminal and inspect results, catch errors and warnings with complete call stack trace straight from the Chrome JavaScript console. In other words, besides debugging, you can execute PHP or WordPress-specific PHP code straight from the terminal and print PHP variables in Chrome Dev Tools JavaScript console along with your normal JavaScript debugging and testing. Keep everything in one place, without leaving the browser to check for your logs or writing temporary PHP test code on a PHP file and refresh your browser page.
Note: PHP version 5.6.0 or above is required to use this plugin.
For support and pull requests, please refer to WP PHP Console GitHub repo and read the instructions there – thank you.
Usage
After you entered WP PHP Plugin password, your browser address bar should show a yellow “key” icon, which, if clicked, will prompt for the password you have set earlier.
The “key” icon will change into a “terminal” icon, click on it to open the PHP Console eval & options form.
After entering the correct password, you can use the Eval Terminal in the PHP Console eval & options form and run any PHP code from it, including WordPress’s own functions: enter one or more lines of PHP code in the black Eval terminal screen, press Ctrl+Enter and see the result in Chrome Dev Tools JavaScript console.
The result includes the output, the return value and the net server execution time.
In your PHP code on the Server, you can call PHP Console debug statements like PC::debug( $var, $tag ) to display PHP variables in the JavaScript console and optionally filter selected tags through the PHP Console eval & options form opened from the address bar in your browser.
In the JavaScript console you will see printed any `PC::debug()“ information, PHP errors, warnings, notices with optional stack trace, which will be useful to debug your plugin or theme.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon