PHP code example of wj008 / debug
1. Go to this page and download the library: Download wj008/debug library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wj008 / debug example snippets
use debug\Logger;
Logger::log("test", "xxxx", 3);
Logger::info("xxxxdsd", ["xxxx"], ["cccc" => "xxx"]);
Logger::log(false);
function a()
{
throw new \Exception("这个是一个测试错误信息");
}
function b()
{
a();
}
try {
b();
} catch (\Exception $e) {
Logger::error($e->getMessage(), PHP_EOL. $e->getTraceAsString());
}
$time1 = microtime(true);
//执行sql 耗时
usleep(50000);
$time2 = microtime(true);
Logger::sql('select * from table where pid=1 and name="xxxx"', $time2 - $time1);