计算php页面运行时间的函数介绍_php技巧

WBOY
Release: 2016-05-17 08:57:21
Original
808 people have browsed it
一个计算php页面运行时间的函数。
复制代码 代码如下:

/*
@ 计算php程序运行时间
*/
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;
?>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template