baagee/php-debug-trace

PHP Debug Trace

v0.0.6 2020-07-23 14:36 UTC

This package is auto-updated.

Last update: 2024-11-08 22:29:04 UTC


README

页面或者浏览器控制台输出php调试信息

使用

<?php
include __DIR__ . '/../vendor/autoload.php';

// \BaAGee\DebugTrace\DebugTrace::init(\BaAGee\DebugTrace\OutputConsole::class);
\BaAGee\DebugTrace\DebugTrace::init(\BaAGee\DebugTrace\OutputHtml::class);
\BaAGee\DebugTrace\TraceCollector::setEnv(['name' => 'fdasa', 'age' => 2342]);

$html = <<<HTML
<html>
<header>
<title>test</title>
</header>
<body>
aaa
</body>
HTML;


\BaAGee\DebugTrace\TraceCollector::dump(true, false, 'aaa', 241, 33.44,
    new ReflectionClass(\BaAGee\DebugTrace\TraceCollector::class),
    function () {
    }, fopen(__FILE__, 'r'), ['age' => 20, 'name' => '斯托克']);
$a = ['name' => 'name', 'age' => 90];
dump($a, 23542);

function test($a)
{
    addTrace('卧槽怎么啦');
    addTrace(str_repeat('嘿嘿嘿', 50));
    \BaAGee\DebugTrace\TraceCollector::addLog('SQL', 'select * from `students`');
    \BaAGee\DebugTrace\TraceCollector::addLog('SQL', 'select * from `scheduling`');
    \BaAGee\DebugTrace\TraceCollector::dump(235,$a);
}

$a = [
    'people' => [
        'name' => "dsfsa",
        'age' => 90,
        'home' => [
            'province' => 'asd'
        ]
    ]
];
test($a);
addTrace('哈哈哈');
\BaAGee\DebugTrace\TraceCollector::addLog('what?', $a);
\BaAGee\DebugTrace\TraceCollector::addLog('what?', 'select * from `scheduling`');

dump($a);


$output = \BaAGee\DebugTrace\DebugTrace::output();

echo $output . $html . '</html>';

aIh64x.png

aI4JqH.md.png