计算php页面运行时间的函数

来源:互联网 发布:最简单交通灯单片机c51 编辑:程序博客网 时间:2024/05/17 07:04
一个计算php页面运行时间的函数。
<?php
/*
@ 计算php程序运行时间
@ www.jbxue.com
*/
function microtime_float()
{
list($usec$sec) = explode(” “, microtime());
return ((float)$usec + (float)$sec);
}

//开始计时,放在头部
$starttime = microtime_float();
//结束计时,放在最底部
$runtime = number_format((microtime_float() – $starttime), 4).’s’;
//输出
echo ‘RunTime:’.$runtime;
?>
0 0
原创粉丝点击