日期:2014-05-17 浏览次数:20445 次
<?php
class query_time_class{
var $start_time;
var $end_time;
function query_start(){
$this->start_time = 0;
$this->end_time = 0;
$this->start_time = $this->get_cur_sec();
}
function query_end(){
$this->end_time = $this->get_cur_sec();
}
function get_query_time(){
$time = floatval($this->end_time - $this->start_time);
$time = sprintf("%01.4f",$time);
return $time;
}
function get_cur_sec(){
list($msec,$sec) = explode(" ", microtime());
$msec = floatval($msec);
$sec = floatval($sec+$msec);
return $sec;
}
function out_put(){
$time = $this->get_query_time();
$output = "执行时间 {$time} 秒";
echo $output;
}