一个计算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;
?>
Statement: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