fsockopen,fopen,file_get_contents 为啥fsockopen是最快的呢
程序员文章站
2022-05-24 12:05:18
...
fsockopen,fopen,file_get_contents 为什么fsockopen是最快的呢
query_time_class.inc.php
执行代码
query_time_class.inc.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;
}
}
?>
执行代码
相关文章
相关视频