代码] [PHP]代码
01 | <?php |
02 | $t = new executeTime; |
03 |
04 | phpinfo(); |
05 |
06 | class executeTime{ |
07 | private $microtime ; |
08 | public function __construct(){ |
09 | $this ->microtime = microtime(true); |
10 | } |
11 |
12 | public function getNow(){ |
13 | $this ->__dectruct(); |
14 | } |
15 |
16 | public function __destruct(){ |
17 | if ( empty ( $_SERVER [ 'REQUEST_TIME_FLOAT' ])) |
18 | echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次执行时间:' , microtime(TRUE) - $this ->microtime, '秒</div>' ; |
19 | else |
20 | echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次执行时间:' , microtime(TRUE) - $_SERVER [ 'REQUEST_TIME_FLOAT' ], '秒</div>' ; |
21 | } |
22 | } |