php检查代码执行所消耗的时间

来源:互联网 发布:模拟战争软件 编辑:程序博客网 时间:2024/04/30 05:02
//开始时间
list($usec, $sec) = explode(" ", microtime());
$startTime = (float)$usec + (float)$sec;
//程序执行过程    
$aa = file_get_contents($url);
$aa = json_decode( $aa, true );
//结束时间    
list($usec, $sec) = explode(" ", microtime());
$endTime = (float)$usec + (float)$sec;
//所消耗的时间计算    
$time = $endTime - $startTime;
0 0
原创粉丝点击