最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php计算页面执行了多长时间代码
时间:2010-06-22 编辑:简简单单 来源:一聚教程网
代码如下 | 复制代码 |
function test() { list($a,$b)= explode(" ",microtime()); return (float)$a+(float)$b; } |
代码如下 | 复制代码 |
$a=test(); echo $a; $time = sprintf("%.12f",(double)test()-$a); |
//方法二
代码如下 | 复制代码 |
function ss_timing_start ($name = 'default') { global $ss_timing_start_times; $ss_timing_start_times[$name] = explode(' ', microtime()); } function ss_timing_stop ($name = 'default') { global $ss_timing_stop_times; $ss_timing_stop_times[$name] = explode(' ', microtime()); } function ss_timing_current ($name = 'default') { global $ss_timing_start_times, $ss_timing_stop_times; if (!isset($ss_timing_start_times[$name])) { return 0; } if (!isset($ss_timing_stop_times[$name])) { $stop_time = explode(' ', microtime()); } else { $stop_time = $ss_timing_stop_times[$name]; } // do the big numbers first so the small ones aren't lost $current = $stop_time[1] - $ss_timing_start_times[$name][1]; $current += $stop_time[0] - $ss_timing_start_times[$name][0]; return $current; } ss_timing_start(); /** 以下是你的页面的代码 */ require_once 'index.php教程'; //index.php是要测试执行时间的页面 /* 页面代码结束 */ ss_timing_stop(); |
//方法三
代码如下 | 复制代码 |
class timer function start(){ $timer->stop(); |
-
上一个: php 类的初始化
-
下一个: php获取文件扩展名二种有效方法
相关文章
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31
- Laravel实现登录跳转功能解析 10-31
- php双向队列解读 10-31
- Laravel异常上下文解决教程 10-24
- php数组查询元素位置方法介绍 10-24