Phpdebug records program execution time and execution status
/*** Debuging ('dtrace '); // view the call stack * debuging ($ var); // Print $ var (var_dump) * debuging ($ var, 'php'); // Print $ var (var_export) * debuging ($ var, $ echo, 2 ); // Output $ var * debuging (_ line0000.0000class) in json format; // It is often used for locating a large number of if statements, or find the end point of the program */function debuging ($ var = '', $ echo ='', $ die = false, $ force = false) {static $ clear; if (0 & $ clear = null) {ob_end_flush (); $ clear = true;} static $ d; if (0 & empty ($ d )) {$ d = 1; debuging ('dtrace ');} $ force & $ _ GET ['debug'] = 1; if (isset ($ _ GET ['debug']) {if ('dtrace '===$ var) {dtrace ($ die );} elseif ($ die = 2) {header ('content-type: application/json'); echo json_encode ($ var);} else {echo"\n"; if ($echo) { echo "$echo:"; } if ($echo === 'php') var_export ( $var ); else var_dump ( $var ); echo "
\ N ";}$ die & die () ;}} function dTrace ($ die = false) {try {static $ lastTime; $ lastTime or $ lastTime = $ _ SERVER ['request _ time']; throw new Exception ();} catch (Exception $ e) {$ currTime = microtime (true ); $ totalTime = $ currTime-$ _ SERVER ['request _ time']; $ execTime = $ currTime-$ lastTime; $ lastTime = $ currTime; echo "\ n "; echo "execTime: $ execTime s.
\ N "; echo" totalTime: $ totalTime s.
\ N "; echo" Trace:
\ N "; // echo $ e-> getTraceAsString (); // debug_print_backtrace (); $ die & die; debuging ($ e-> getTraceAsString (), 'php', $ die) ;}}for ($ I = 0; $ I <100000; $ I ++) {$ a ++ = $ I ;} dTrace ();