Skip to content

Instantly share code, notes, and snippets.

@raftaar1191
Created July 22, 2020 12:04
Show Gist options
  • Save raftaar1191/75fff8d3d887eef173eafbf318cc380e to your computer and use it in GitHub Desktop.
Save raftaar1191/75fff8d3d887eef173eafbf318cc380e to your computer and use it in GitHub Desktop.
Debug
// if ( isset( $_GET['debug123'] ) ) {
function bb_track_log( $end = false ) {
static $starttime;
if ( ! $end ) {
$starttime = time();
register_shutdown_function(
function() {
bb_track_log( true );
}
);
} else {
$data = array();
$data[] = array(
$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ', // URL
( time() - $starttime ), // Time Consume
json_encode( $_POST ), // Post Data
json_encode( array() ), // Extra Data
);
$file_name = dirname( __FILE__ ) . '/' . basename( __FILE__ ) . '-kjha45.csv';
$fp = fopen( $file_name, 'a' );
foreach ( $data as $val ) {
fputcsv( $fp, $val );
}
fclose( $fp );
}
}
// bb_track_log();
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment