php简单计算页面加载时间的方法

yipeiwu_com5年前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程序设计有所帮助。

相关文章

php字符比较函数similar_text、strnatcmp与strcasecmp用法分析

本文实例讲述了php字符比较函数similar_text、strnatcmp与strcasecmp用法。分享给大家供大家参考。具体如下: ① similar_text() 函数计算两个字...

php计算整个目录大小的方法

本文实例讲述了php计算整个目录大小的方法。分享给大家供大家参考。具体实现方法如下: /** * Calculate the full size of a directory *...

求PHP数组最大值,最小值的代码

复制代码 代码如下: <?php $fruits = array("155::vbscript:://www.jb51.net/list/list_114_1.htm", "1::...

PHP时间日期增减操作示例【date strtotime实现加一天、加一月等操作】

本文实例讲述了PHP时间日期增减操作。分享给大家供大家参考,具体如下: 时间函数是PHP里面的日常函数,时间的默认时期,今天、昨天、明天 、上一周、下一周,本周开始时间和结束时间;本月开...

PHP中call_user_func_array回调函数的用法示例

call_user_func_array call_user_func_array — 调用回调函数,并把一个数组参数作为回调函数的参数 mixed call_user_func_a...