fsockopen,fopen,file_get_contents 为啥fsockopen是最快的呢

WBOY
Release: 2016-06-13 13:01:07
Original
899 people have browsed it

fsockopen,fopen,file_get_contents 为什么fsockopen是最快的呢
query_time_class.inc.php

<?php<br />
    class query_time_class{<br />
        <br />
        var $start_time;<br />
        var $end_time;<br />
        <br />
        function query_start(){<br />
            <br />
            $this->start_time = 0;<br />
            $this->end_time   = 0;<br />
            $this->start_time = $this->get_cur_sec();<br />
            <br />
        }<br />
        <br />
        function query_end(){<br />
            <br />
            $this->end_time = $this->get_cur_sec();<br />
            <br />
        }<br />
        <br />
        function get_query_time(){<br />
            <br />
            $time = floatval($this->end_time - $this->start_time);<br />
            $time = sprintf("%01.4f",$time);<br />
            return $time;<br />
            <br />
        }<br />
        <br />
        function get_cur_sec(){<br />
            <br />
            list($msec,$sec) = explode(" ", microtime());<br />
            $msec            = floatval($msec);<br />
            $sec             = floatval($sec+$msec);<br />
            return $sec;<br />
            <br />
        }<br />
        function out_put(){<br />
            <br />
            $time   = $this->get_query_time();<br />
            $output = "执行时间 {$time} 秒";<br />
            echo $output;<br />
            <br />
        }<br />
        <br />
    } <br />
<br />
<br />
?>
Copy after login



执行代码

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template