Debug.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <div style="margin: 60px 0; padding:2em; background:#ECF5FA; color:#000; clear:both;">
  2. <b>Memory Usage</b>
  3. <pre>
  4. <?php print number_format(memory_get_usage() - START_MEMORY_USAGE); ?> bytes
  5. <?php print number_format(memory_get_usage()); ?> bytes (process)
  6. <?php print number_format(memory_get_peak_usage(TRUE)); ?> bytes (process peak)
  7. </pre>
  8. <b>Execution Time</b>
  9. <pre><?php print round((microtime(true) - START_TIME), 5); ?> seconds</pre>
  10. <b>URL Path</b>
  11. <?php print dump(PATH); ?>
  12. <b>Locale</b>
  13. <?php print dump(Locale::getDefault()); ?>
  14. <b>Timezone</b>
  15. <?php print dump(date_default_timezone_get()); ?>
  16. <?php
  17. if(class_exists('\Micro\Database', FALSE))
  18. {
  19. $highlight = function($string)
  20. {
  21. return str_replace(array("&lt;?php", "?&gt;"),'',substr(highlight_string('<?php '.$string.' ?>', TRUE),36));
  22. };
  23. foreach(\Micro\Database::$queries as $type => $queries)
  24. {
  25. print '<b>'.$type.' ('. count($queries). ' queries)</b>';
  26. foreach($queries as $data)
  27. {
  28. print '<pre>'. $highlight(wordwrap($data[1])."\n/* ".round(($data[0]*1000), 2).'ms */'). '</pre>';
  29. }
  30. }
  31. if(\Micro\Error::$found)
  32. {
  33. print '<b>Last Query Run</b>';
  34. print '<pre>'. $highlight(\Micro\DataBase::$last_query). '</pre>';
  35. }
  36. }
  37. ?>
  38. <?php if(!empty($_POST)) { ?>
  39. <b>$_POST Data</b>
  40. <?php print dump($_POST); ?>
  41. <?php } ?>
  42. <?php if(!empty($_GET)) { ?>
  43. <b>$_GET Data</b>
  44. <?php print dump($_GET); ?>
  45. <?php } ?>
  46. <?php if(!empty($_SESSION)) { ?>
  47. <b>Session Data</b>
  48. <?php print dump($_SESSION); ?>
  49. <?php } ?>
  50. <?php $included_files = get_included_files(); ?>
  51. <b><?php print count($included_files); ?> PHP Files Included:</b>
  52. <pre>
  53. <?php foreach($included_files as $file) print str_replace(SP, '', $file). "\n"; ?>
  54. </pre>
  55. <b>Server Info</b>
  56. <?php print dump($_SERVER); ?>
  57. </div>