多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 使用方法 1.在`/usr/themes/handsome/functions.php`末尾添加如下代码 ``` //加载耗时 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 = number_format( $timeend - $timestart, $precision ); $r = $timetotal < 1 ? $timetotal * 1000 . " ms" : $timetotal . " s"; if ( $display ) { echo $r; } return $r; } ``` 2.然后在`/usr/themes/handsome/component/sidebar.php`下添加显示代码 ``` <li class="list-group-item"> <i class="glyphicon glyphicon-time text-muted"></i> <span class="badge pull-right"><?php echo timer_stop();?></span><?php _me("加载耗时") ?></li> ``` 位置如下图: ![](https://img.kancloud.cn/5c/22/5c22519ae8219b3260ec069c98d9db7f_818x243.png) ## 效果 ![](https://img.kancloud.cn/a5/b1/a5b169e11498c466020b0635a6318bbc_227x261.png)