[root@74-82-173-217 ~]# cat runtime.php
StartTime = $this->get_microtime();
}
function stop()
{
$this->StopTime = $this->get_microtime();
}
function spent()
{
return round(($this->StopTime – $this->StartTime) * 1000, 1);
}
}
?>
在 php 文件头加上开始代码
include (“runtime.php”);
$runtime= new runtime;
$runtime->start();
在 php 文件尾部加上结束代码
$runtime->stop();
echo “页面执行时间: “.$runtime->spent().” 毫秒”;
相关日志PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module
升级最新 Nginx Mysql Php
PHP关闭浏览器后仍然继续执行的函数
PHP 基于文件头的文件类型验证类
几个有用的php字符串过滤,转换函数
转载请注明:爱开源 » PHP 计算页面执行时间