Skip to content
🚧 PHP美化调试工具
PHP
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
heplers
src
.gitignore
README.md
composer.json

README.md

VarDumper组件

Latest Stable Version Total Downloads Latest Unstable Version License

安装方法 :

composer require wangningkai/var-dumper

使用方法:

可以参考目录下的 heplers/functions.php 内容

<?php

use WangNingkai\VarDumper\Dumper;

if (! function_exists('dd')) {
    /**
     * Dump the passed variables and end the script.
     *
     * @param  mixed
     * @return void
     */
    function dd($args)
    {
        foreach ($args as $var) {
            (new Dumper)->dump($var);
        }
        die(1);
    }
}

if (! function_exists('dda')) {
    /**
     * Dump the passed array variables and end the script.
     *
     * @param  mixed
     * @return void
     */
    function dda($args)
    {
        foreach ($args as $var) {
            (new Dumper)->dump($var->toArray());
        }
        die(1);
    }
}

将其加入到项目的全局函数中去

在其他文件中可以参考下面


<?php

require __DIR__.'/vendor/autoload.php';


$var = array(

    'a simple string' => 'in an array of 5 elements',

    'a float' => 1.0,

    'an integer' => 1,

    'a boolean' => true,

    'an empty array' => array(),

);

dd($var);
You can’t perform that action at this time.