- function timer_start() {
- global $timestart;
- $mtime = explode( ' ', microtime() );
- $timestart = $mtime[1] + $mtime[0];
- return true;
- }
- timer_start();
- function timer_stop( $display = 0, $precision = 3 ) {
- global $timestart, $timeend;
- $mtime = explode( ' ', microtime() );
- $timeend = $mtime[1] + $mtime[0];
- $timetotal = $timeend - $timestart;
- $r = number_format( $timetotal, $precision );
- if ( $display )
- echo $r;
- return $r;
- }
复制代码
- <?php echo '耗时:',timer_stop(), 's';?>
复制代码
这是typecho的执行时间 |