php如何计算页面加载时间?本文主要介绍了php简单计算页面加载时间的方法,涉及php针对页面加载时间的计算技巧。希望对大家有所帮助。
本文实例讲述了php简单计算页面加载时间的方法。分享给大家供大家参考。具体实现方法如下:
简单的把开始时间放在页面头部,结束时间放在页面尾部,计算页面加载时间
$start = time();
// put a long operation in here
sleep(2);
$diff = time() - $start;
print "this page needed $diff seconds to load :-)";
// if you want a more exact value, you could use the
// microtime function
相关推荐:
php解决session文件阻塞
php伪重载的使用
php通过opcache提升性能
以上就是php简单计算页面加载时间的详细内容。