跳到内容

PHP Console Log

v1.0.1

Marcus Viar · 2019年7月10日 上架

Log PHP variables and arrays to the web console in your browser via JavaScript's console.log(). No browser extensions required.

正在使用
10+
评分
5.0 / 5
累计下载
2,887
最近更新
2020年2月7日
1 条评价需要 WordPress 4.4+已测试到 5.3.28PHP 5.6.20+

贡献者

截图

If PHP Console Log is working and you have not called do_action( 'php_console_log', 'My String or Array' ); you will see a message similar to this in your browsers web console.
If PHP Console Log is working and you have not called do_action( 'php_console_log', 'My String or Array' ); you will see a message similar to this in your browsers web console.

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);

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums