王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

Typecho 页面载入时候代码

Typecho 页面载入时候代码


有些主题大概用到加载条,须要推断加载时候,就要用到以下代码了

<?phpfunction 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 'Loading spends ',timer_stop(), ' s.';?>

挪用代码:


相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。