[WordPress] 外掛分享: PHP Console Log

首頁外掛目錄 › PHP Console Log
WordPress 外掛 PHP Console Log 的封面圖片
20+
安裝啟用
★★★★★
5/5 分(1 則評價)
2231 天前
最後更新
問題解決
WordPress 4.4+ PHP 5.6.20+ v1.0.1 上架:2019-07-09

內容簡介

範例

將 do_action( ‘php_console_log’, ‘My String or Array’ ); 函式放在 WordPress 插件 PHP 代碼中的任何位置。您傳入 do_action( ‘php_console_log’, ‘My String or Array’ ); 的值將被記錄到瀏覽器中的 Web 控制台。

傳入字串
$my_string = 'My String';
do_action( 'php_console_log', $my_string );

傳入陣列
$my_array = array(
'elm 1',
'elm 2',
);
do_action( 'php_console_log', $my_array );

傳入關聯陣列
$my_array = array(
'key 1'=>'elm 1',
'key 2'=>'elm 2',
);
do_action( 'php_console_log', $my_array);

傳入無限層次的引數(多維陣列)
$my_array = array(
'My String 1',
'My String 2',
array(
'elm 1',
'elm 2',
),
'My String 3',
array(
'key 1'=>'elm 1',
'key 2'=>'elm 2',
'key 3' => array(
'key 3a' => 'elm 3a',
'key 3b' => 'elm 3b',
),
),
'My String 4'
);
do_action( 'php_console_log', $my_array);

外掛標籤

開發者團隊

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

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

原文外掛簡介

Examples
Place the do_action( ‘php_console_log’, ‘My String or Array’ ); function anywhere in your WordPress plugin PHP code. The value(s) you pass into do_action( ‘php_console_log’, ‘My String or Array’ ); will be logged to the web console in your browser.
Pass in a string
$my_string = 'My String';
do_action( 'php_console_log', $my_string );

Pass in an array
$my_array = array(
'elm 1'
'elm 2',
);
do_action( 'php_console_log', $my_array );

Pass in an associative array
$my_array = array(
'key 1'=>'elm 1',
'key 2'=>'elm 2',
);
do_action( 'php_console_log', $my_array);

Pass in an unlimited number of arguments nested to an unlimited depth (multi-dimensional array)
$my_array = array(
'My String 1',
'My String 2',
array(
'elm 1',
'elm 2',
),
'My String 3',
array(
'key 1'=>'elm 1',
'key 2'=>'elm 2',
'key 3' => array(
'key 3a' => 'elm 3a',
'key 3b' => 'elm 3b',
),
),
'My String 4'
);
do_action( 'php_console_log', $my_array);

延伸相關外掛

文章
Filter
Apply Filters
Mastodon