/** * debuging (' dtrace '); View Call stack * debuging ($var); Print $var (var_dump) * debuging ($var, ' php '); Print $var (var_export) * debuging ($var, $echo, 2); Output $var * debuging (__line__.__class) in JSON format;//often used in large if statement body positioning, or to find the program end point */function debuging ($var = ", $echo =", $die = f Alse, $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 ();